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 feat: Use vitest instead of jest, run all the specs anywhere in app/ folder in the CI (#9722) 2024-07-10 08:32:16 -07:00
fixtures feat: Rewrite automations/methodsMixin to a composable (#9956) 2024-08-27 12:30:08 +05:30
actionQueryGenerator.spec.js feat: Add the ability to add new automation rule (#3459) 2022-02-02 18:46:07 +05:30
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 fix: Edit custom views folder (#7670) 2023-08-04 13:54:21 +05:30
DOMHelpers.spec.js feat: add promise based loader for FB script (#9780) 2024-07-22 11:32:05 +05:30
downloadHelper.spec.js feat: Add business hours in downloadable reports (#4674) 2022-05-27 09:26:59 +05:30
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 feat: Custom attributes in automations and refactor (#4548) 2022-11-10 10:53:29 +05:30
flag.spec.js chore: Replace packages with native functions (#5140) 2022-08-03 17:08:21 +05:30
inbox.spec.js fix: Fix issues with contact routes in old navigation sidebar (#10547) 2024-12-05 22:46:57 -08:00
inboxFixture.js feat: Support Regex validation for custom attributes (#7856) 2024-01-23 18:01:57 +04:00
macrosFixtures.js feat: Add assign agent option in macro (#5821) 2022-11-09 09:52:48 -08:00
macrosHelper.spec.js feat: Add an action in Macro to change the priority (#6940) 2023-04-24 17:14:30 +05:30
permissionsHelper.spec.js chore: Custom Roles to manage permissions [ UI ] (#9865) 2024-09-17 11:40:11 -07:00
portalHelper.spec.js feat: Add support to uncategorized articles (#6912) 2023-05-02 15:35:26 +05:30
preChat.spec.js feat: Support Regex validation for custom attributes (#7856) 2024-01-23 18:01:57 +04:00
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 feat: Use vitest instead of jest, run all the specs anywhere in app/ folder in the CI (#9722) 2024-07-10 08:32:16 -07:00
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