-
Notifications
You must be signed in to change notification settings - Fork 13k
regression: Stale phone numbers being available for outbound message #37053
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 not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
🦋 Changeset detectedLatest commit: b6c38a5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 40 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 |
WalkthroughImplements cache lifecycle adjustments for outbound providers: adds unmount-time query cache removal in OutboundMessageWizard, changes useOutboundProvidersList default staleTime to 5 minutes and removes gcTime, and refactors omnichannel query keys for outbound providers and metadata. Adds a changeset noting a patch for stale phone numbers. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant W as OutboundMessageWizard
participant Q as React Query (useOutboundProvidersList)
participant S as Server
U->>W: Open Outbound Message Wizard
W->>Q: useQuery(outboundProviders[filter])
Q->>S: Fetch providers
S-->>Q: Providers list
Q-->>W: Cache + provide data
Note over W,Q: Wizard used with cached providers (staleTime = 5m)
U-->>W: Navigate away / close wizard
W->>Q: removeQueries(outboundProviders())
U->>W: Reopen wizard later
W->>Q: useQuery(outboundProviders[filter])
alt Cache missed (removed)
Q->>S: Refetch providers
S-->>Q: Fresh providers list
else Cache hit (within 5m, other views)
Q-->>W: Serve cached, background update as needed
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-7.11.0 #37053 +/- ##
==================================================
+ Coverage 67.29% 67.37% +0.08%
==================================================
Files 3337 3328 -9
Lines 113326 113384 +58
Branches 20576 20641 +65
==================================================
+ Hits 76261 76391 +130
+ Misses 34450 34387 -63
+ Partials 2615 2606 -9
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: 1
🧹 Nitpick comments (3)
.changeset/few-flowers-bow.md (1)
5-5: Polish the changeset entry for clarity.Add a period and the issue reference for traceability.
-Fixes stale phone numbers being available for outbound message +Fixes stale phone numbers being available for outbound messages. (CTZ-338)apps/meteor/client/lib/queryKeys.ts (1)
79-84: LGTM: key shape enables bulk matching for providers and metadata.
- outboundProviders now supports an optional filter, which is consistent with other keys.
- outboundProviderMetadata derives from the base path, so base-key invalidation/removal hits both lists and metadata.
Minor: for naming consistency with contacts, consider renaming the parameter from filter to params in a follow-up. No functional change required.
apps/meteor/client/components/Omnichannel/OutboundMessage/components/OutboundMessageWizard/OutboundMessageWizard.tsx (1)
69-75: Replace removeQueries with invalidateQueries in cleanup
invalidateQueries marks providers and metadata stale (without evicting active observers) and will refetch on next mount.useEffect( () => () => { - // Clear cached providers and metadata on unmount to avoid stale data - void queryClient.removeQueries({ queryKey: omnichannelQueryKeys.outboundProviders() }); + // Mark providers and metadata as stale on unmount to avoid stale data + queryClient.invalidateQueries({ queryKey: omnichannelQueryKeys.outboundProviders(), exact: false }); }, [queryClient], );Optional: cancel in-flight fetches:
void queryClient.cancelQueries({ queryKey: omnichannelQueryKeys.outboundProviders(), exact: false });
📜 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 (4)
.changeset/few-flowers-bow.md(1 hunks)apps/meteor/client/components/Omnichannel/OutboundMessage/components/OutboundMessageWizard/OutboundMessageWizard.tsx(4 hunks)apps/meteor/client/components/Omnichannel/OutboundMessage/hooks/useOutboundProvidersList.ts(1 hunks)apps/meteor/client/lib/queryKeys.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
apps/meteor/client/components/Omnichannel/OutboundMessage/components/OutboundMessageWizard/OutboundMessageWizard.tsx (1)
apps/meteor/client/lib/queryKeys.ts (1)
omnichannelQueryKeys(30-84)
apps/meteor/client/lib/queryKeys.ts (1)
packages/core-typings/src/omnichannel/outbound.ts (1)
IOutboundProvider(134-139)
⏰ 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). (3)
- GitHub Check: 🚀 Notify external services - draft
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🔇 Additional comments (2)
apps/meteor/client/components/Omnichannel/OutboundMessage/components/OutboundMessageWizard/OutboundMessageWizard.tsx (1)
6-6: LGTM: correct query client usage and key imports.Imports and client instantiation look good and align with the new query key shape.
Also applies to: 16-16, 32-32
apps/meteor/client/components/Omnichannel/OutboundMessage/hooks/useOutboundProvidersList.ts (1)
17-17: LGTM: sensible default staleTime (5 min).Balances network with freshness, especially with unmount invalidation.
Proposed changes (including videos or screenshots)
This PR fixes an issue where disconnected phone numbers remained available as outbound senders due to stale cached data. This is resolved by clearing the outbound providers query cache when the wizard unmounts, ensuring the sender list is fresh each time.
Issue(s)
CTZ-338
CTZ-346
Steps to test or reproduce
Further comments
Summary by CodeRabbit
Bug Fixes
Performance and Reliability
Chores