iachat/app/javascript/dashboard/helper
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
..
AnalyticsHelper feat: Add June events for linear integration (#11007) 2025-03-03 13:33:11 +05:30
AudioAlerts feat: handle mine event for incoming messages (#10867) 2025-02-11 17:45:31 +05:30
CacheHelper feat: fallback to DB localStorage for idb names (#8682) 2024-01-15 15:08:15 +05:30
commandbar feat: Rewrite command bar mixin to a composable (#10015) 2024-08-26 15:55:59 +05:30
specs feat: Add debounce for meta query (#11195) 2025-03-27 19:41:02 -07:00
actionCable.js fix: Remove Report API calls from being called on every event (#10691) 2025-01-15 11:23:00 -08:00
actionQueryGenerator.js fix: Unable to save automation "send email to team" (#6052) 2022-12-12 20:10:33 +05:30
agentHelper.js fix: Translate "None" option in agent assignment dropdown (#11060) 2025-03-11 14:49:27 -07:00
APIHelper.js fix: Allow users to login even if they have access to more than 15 accounts (#4475) 2022-04-14 20:54:26 +05:30
auditlogHelper.js fix: TypeError: Cannot read properties of null (reading 'user_id') (#9884) 2024-08-07 14:42:01 +05:30
automationHelper.js fix: Translate "None" option in automation select (#11076) 2025-03-13 16:44:46 -07:00
commons.js fix: Update the translation for the text used in isTyping method (#10384) 2024-11-04 20:04:08 -08:00
conversationHelper.js fix: TypeError: t.messages.at is not a function (#9950) 2024-08-13 19:16:15 +05:30
customViewsHelper.js feat: Add support for frontend filtering of conversations (#11111) 2025-03-24 19:39:04 -07:00
DOMHelpers.js feat: add promise based loader for FB script (#9780) 2024-07-22 11:32:05 +05:30
downloadHelper.js feat: Add business hours in downloadable reports (#4674) 2022-05-27 09:26:59 +05:30
editorHelper.js feat: Vite + vue 3 💚 (#10047) 2024-10-02 00:36:30 -07:00
featureHelper.js feat: Add frontend changes for Captain limits (#10749) 2025-01-24 09:21:09 -08:00
filterQueryGenerator.js chore: Support multiple values for automation message content (#7871) 2023-09-19 13:04:58 +05:30
flag.js chore: Replace packages with native functions (#5140) 2022-08-03 17:08:21 +05:30
inbox.js fix: New compose conversation form (#10548) 2024-12-06 15:40:06 +05:30
labelColor.js feat: Create portal UI improvements (#5261) 2022-08-18 17:11:19 +05:30
permissionsHelper.js chore: Custom Roles to manage permissions [ UI ] (#9865) 2024-09-17 11:40:11 -07:00
portalHelper.js feat: Update button component (#10362) 2024-10-29 14:00:24 +05:30
preChat.js feat: Support Regex validation for custom attributes (#7856) 2024-01-23 18:01:57 +04:00
pushHelper.js feat: Replace alertMixin usage with useAlert (#9793) 2024-07-23 16:41:11 +05:30
ReconnectService.js feat: Vite + vue 3 💚 (#10047) 2024-10-02 00:36:30 -07:00
routeHelpers.js chore: Custom Roles to manage permissions [ UI ] (#9865) 2024-09-17 11:40:11 -07:00
scriptHelpers.js fix: Initialize SDK along with emitter registration (#10896) 2025-02-12 22:14:04 -08:00
snoozeHelpers.js feat(v4): Update Inbox view card design (#10599) 2025-01-07 21:11:54 +05:30
states.js Move src to dashboard (#152) 2019-10-16 14:36:17 +05:30
themeHelper.js feat: Support bigger font size in dashboard (#10974) 2025-02-27 12:10:33 +05:30
uploadHelper.js feat: Add the ability to paste images to editor (#10072) 2024-09-11 09:44:13 +05:30
URLHelper.js feat(v4): Update the help center portal design (#10296) 2024-10-23 22:09:36 -07:00
validations.js chore: Remove unused files in contact (#10570) 2024-12-11 19:29:24 -08:00