iachat/app/javascript/dashboard/helper/specs
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
..
CacheHelper
fixtures feat: Rewrite automations/methodsMixin to a composable (#9956) 2024-08-27 12:30:08 +05:30
actionQueryGenerator.spec.js
agentHelper.spec.js fix: Translate "None" option in agent assignment dropdown (#11060) 2025-03-11 14:49:27 -07:00
auditlogHelper.spec.js fix: TypeError: Cannot read properties of null (reading 'user_id') (#9884) 2024-08-07 14:42:01 +05:30
automationHelper.spec.js fix: Translate "None" option in automation select (#11076) 2025-03-13 16:44:46 -07:00
commons.spec.js fix: Update the translation for the text used in isTyping method (#10384) 2024-11-04 20:04:08 -08:00
conversationHelper.spec.js feat: Rewrite conversations mixin to a helper (#9931) 2024-08-13 15:15:04 +05:30
customViewsHelper.spec.js
DOMHelpers.spec.js feat: add promise based loader for FB script (#9780) 2024-07-22 11:32:05 +05:30
downloadHelper.spec.js
editorContentHelper.spec.js feat: Adds support for selecting emojis using the keyboard (#10055) 2024-09-04 11:32:54 +05:30
editorHelper.spec.js chore: fix circleci on vite build (#10214) 2024-10-07 15:27:41 +05:30
filterQueryGenerator.spec.js
flag.spec.js
inbox.spec.js fix: Fix issues with contact routes in old navigation sidebar (#10547) 2024-12-05 22:46:57 -08:00
inboxFixture.js
macrosFixtures.js
macrosHelper.spec.js
permissionsHelper.spec.js chore: Custom Roles to manage permissions [ UI ] (#9865) 2024-09-17 11:40:11 -07:00
portalHelper.spec.js
preChat.spec.js
ReconnectService.spec.js chore: fix circleci on vite build (#10214) 2024-10-07 15:27:41 +05:30
routeHelpers.spec.js chore: Custom Roles to manage permissions [ UI ] (#9865) 2024-09-17 11:40:11 -07:00
snoozeHelpers.spec.js feat(v4): Update Inbox view card design (#10599) 2025-01-07 21:11:54 +05:30
themeHelper.spec.js
uploadHelper.spec.js feat: Add the ability to paste images to editor (#10072) 2024-09-11 09:44:13 +05:30
URLHelper.spec.js feat(v4): Update the help center portal design (#10296) 2024-10-23 22:09:36 -07:00
validations.spec.js chore: Remove unused files in contact (#10570) 2024-12-11 19:29:24 -08:00