-
Notifications
You must be signed in to change notification settings - Fork 13k
fix: Disabled cache for outbound message providers #36995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Looks like this PR is ready to merge! 🎉 |
🦋 Changeset detectedLatest commit: 4218524 The changes in this PR will be included in the next version bump. This PR includes changesets to release 39 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughAdded default values for options in useOutboundProvidersList: Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant UI as Outbound UI
participant Hook as useOutboundProvidersList
participant Query as react-query useQuery
UI->>Hook: request providers list (mount / refresh)
Hook->>Query: call useQuery(queryKey, queryFn, { staleTime:0, gcTime:0, ... })
Note right of Query#lightblue: react-query handles cache with passed options
Query-->>Hook: providers data / cache status
Hook-->>UI: return providers list
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing touches🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #36995 +/- ##
===========================================
- Coverage 67.38% 66.27% -1.11%
===========================================
Files 3339 3393 +54
Lines 113204 115451 +2247
Branches 20532 21192 +660
===========================================
+ Hits 76278 76512 +234
- Misses 34329 36324 +1995
- Partials 2597 2615 +18
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/meteor/client/components/Omnichannel/OutboundMessage/hooks/useOutboundProvidersList.ts (1)
16-29: Consider performance implications of disabled caching.While disabling the cache resolves the stale data issues described in CTZ-338 and CTZ-342, this means every component using this hook will make a fresh API request. Consider if there are scenarios where multiple components might use this hook simultaneously, potentially causing unnecessary API load.
If performance becomes a concern, you could implement a more targeted approach:
-const { type = 'phone', enabled = true, staleTime = 0, gcTime = 0, ...queryOptions } = options || {}; +const { type = 'phone', enabled = true, staleTime = 0, gcTime = 0, refetchOnMount = true, ...queryOptions } = options || {};And add
refetchOnMountto the query options to ensure fresh data on mount while allowing some caching during the component lifecycle.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
apps/meteor/client/components/Omnichannel/OutboundMessage/hooks/useOutboundProvidersList.ts(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: 🚢 Build Docker Images for Testing (alpine)
🔇 Additional comments (2)
apps/meteor/client/components/Omnichannel/OutboundMessage/hooks/useOutboundProvidersList.ts (2)
17-17: LGTM! Cache disabled effectively for fresh provider data.The addition of
staleTime = 0andgcTime = 0as defaults correctly disables caching for outbound providers. This ensures the UI always fetches up-to-date provider status, addressing the issues with stale WhatsApp disconnection states and app enablement statuses.
27-27: LGTM! Proper configuration forwarded to React Query.The
gcTimeoption is correctly forwarded to theuseQueryconfiguration, completing the cache disabling implementation alongside thestaleTimesetting.
MartinSchoeler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a changeset?
Proposed changes (including videos or screenshots)
This PR disabled cache for outbound message providers to ensure the data being consumed by the UI is always up to date.
Issue(s)
CTZ-338
CTZ-342
Steps to test or reproduce
Further comments
Summary by CodeRabbit