iachat/app/javascript/dashboard
Shivam Mishra 9761214860
feat: Add debounce for meta query (#11195)
This PR combines the approaches in
https://github.com/chatwoot/chatwoot/pull/11190 and
https://github.com/chatwoot/chatwoot/pull/11187 to debounce the meta
request with a max wait time of 2.5 seconds With 500 concurrent users,
the theoretical limit with this is 720K requests per minute, if all of
them continuously receive websocket events.

The max wait of 2.5 seconds is still very generous, and we can easily
make it 2 seconds for smaller accounts and 5 seconds for larger
accounts.

```js
const debouncedFetchMetaData = debounce(fetchMetaData, 500, false, 200);
const longDebouncedFetchMetaData = debounce(fetchMetaData, 500, false, 5000);

export const actions = {
  get: async ({ commit, state: $state }, params) => {
    if ($state.allCount > 100) {
      longDebouncedFetchMetaData(commit, params);
    } else {
      debouncedFetchMetaData(commit, params);
    }
  },
  set({ commit }, meta) {
    commit(types.SET_CONV_TAB_META, meta);
  },
};

```

Related Utils PR: https://github.com/chatwoot/utils/pull/49
Here's the debounce in action

<img width="934" alt="image"
src="https://github.com/user-attachments/assets/5265a108-9c64-4488-9b4c-2e0d06aadc50"
/>

---------

Co-authored-by: Pranav <pranavrajs@gmail.com>
2025-03-27 19:41:02 -07:00
..
api feat(apps): Shopify Integration (#11101) 2025-03-19 15:37:55 -07:00
assets feat: Add RTL Support to Widget (#11022) 2025-03-21 09:39:03 -07:00
components feat: Add support for frontend filtering of conversations (#11111) 2025-03-24 19:39:04 -07:00
components-next chore: Add cache to improve widget performance (#11163) 2025-03-24 16:04:49 -07:00
composables feat(apps): Shopify Integration (#11101) 2025-03-19 15:37:55 -07:00
constants feat: Add visibility checks for installation types (#10773) 2025-02-21 14:48:31 -08:00
helper feat: Add debounce for meta query (#11195) 2025-03-27 19:41:02 -07:00
i18n fix(i18n): correct settings name translation in pt-BR (#11172) 2025-03-25 20:27:41 -07:00
mixins chore: fix circleci on vite build (#10214) 2024-10-07 15:27:41 +05:30
modules chore: Update buttons in conversation screens - 2 (#11134) 2025-03-21 21:54:54 +05:30
routes fix: Support Business hours when downloading the agent reports. 2025-03-25 20:26:18 -07:00
store feat: Add debounce for meta query (#11195) 2025-03-27 19:41:02 -07:00
App.vue feat: Support bigger font size in dashboard (#10974) 2025-02-27 12:10:33 +05:30
featureFlags.js feat: Add visibility checks for installation types (#10773) 2025-02-21 14:48:31 -08:00