Skip to content

Conversation

@aleksandernsilva
Copy link
Contributor

@aleksandernsilva aleksandernsilva commented Sep 18, 2025

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

  • Chores
    • Adjusted default caching for outbound message providers and added a garbage-collection timing option.
    • Outbound provider data is no longer cached by default, ensuring the UI reflects the latest provider status and changes.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Sep 18, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Sep 18, 2025

🦋 Changeset detected

Latest commit: 4218524

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 39 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 18, 2025

Walkthrough

Added default values for options in useOutboundProvidersList: staleTime now defaults to 0 and a new gcTime option (default 0) is accepted and forwarded to useQuery. No other behavioral or public signature changes.

Changes

Cohort / File(s) Summary of Changes
Outbound providers hook
apps/meteor/client/components/Omnichannel/OutboundMessage/hooks/useOutboundProvidersList.ts
Set default staleTime = 0; added gcTime = 0 in options; forwarded gcTime into useQuery options. No changes to queryFn, queryKey, retry, enabled logic, or exported signatures.
Release notes / changeset
.changeset/lazy-kings-appear.md
Added changeset describing a patch release and noting cache disabling behavior for outbound message providers.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A little rabbit hopped in code tonight,
set stale to zero, made gcTime right.
I cleared the crumbs, I pruned the heap,
fresh choices bloom where old ones sleep.
Hooray—outbound lists are bright! 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Linked Issues Check ❓ Inconclusive The PR disables the outbound providers cache (staleTime=0 and gcTime=0), which directly targets stale provider lists and therefore likely addresses the disconnected WhatsApp-number symptom described in CTZ-338 by forcing fresh fetches for the outbound form CTZ-338. However, the PR includes no tests or changes to explicit cache invalidation in the disconnect/reconnect or app enable/disable flows and does not show modifications to the code paths that control the upsell modal, so it is unclear whether the upsell-modal issue is resolved by this change alone [CTZ-342]. Because the link between this hook's cache behavior and the upsell modal's persisted state is not demonstrated, I cannot conclusively confirm both linked issues are fully resolved. Please add verification steps or automated tests that reproduce CTZ-338 and CTZ-342 and confirm the fixes, and consider adding explicit query invalidation (e.g., queryClient.invalidateQueries for the outbound providers key) in the disconnect/reconnect and app enable/disable flows to guarantee fresh fetches; if the upsell modal uses a different cached state, extend the invalidation approach to that hook/component and document the results in the PR description.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "fix: Disabled cache for outbound message providers" is concise, directly describes the primary code change (disabling caching for outbound providers) shown in the changeset, and is specific enough for a teammate scanning PR history to understand the main intent; it does not include noisy file lists or vague wording. The phrasing maps cleanly to the modifications in useOutboundProvidersList (staleTime/gcTime defaults) and the accompanying changeset. This makes the title appropriate for the changeset's scope and purpose.
Out of Scope Changes Check ✅ Passed The changes are limited to the useOutboundProvidersList hook (adjusting staleTime/gcTime) and a .changeset entry; there are no other source files or public API signature changes shown in the raw_summary. These modifications are directly related to the PR objective of keeping outbound provider UI data up to date, so I do not detect out-of-scope or unrelated changes in this diff. The PR appears focused and minimal in scope.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/outbound-providers-cache

📜 Recent 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 2da8e22 and ad8a97b.

📒 Files selected for processing (1)
  • .changeset/lazy-kings-appear.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/lazy-kings-appear.md
⏰ 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)
  • GitHub Check: 🔨 Test Storybook / Test Storybook
  • GitHub Check: 🔨 Test Unit / Unit Tests
  • GitHub Check: 🔎 Code Check / Code Lint
  • GitHub Check: 🔎 Code Check / TypeScript
  • GitHub Check: 📦 Meteor Build - coverage
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Sep 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.27%. Comparing base (399ab02) to head (4218524).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             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     
Flag Coverage Δ
e2e 56.93% <0.00%> (-0.09%) ⬇️
unit 71.23% <100.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aleksandernsilva aleksandernsilva marked this pull request as ready for review September 18, 2025 22:59
@aleksandernsilva aleksandernsilva requested a review from a team as a code owner September 18, 2025 22:59
@aleksandernsilva aleksandernsilva added this to the 7.11.0 milestone Sep 18, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 refetchOnMount to 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.

📥 Commits

Reviewing files that changed from the base of the PR and between c5d4879 and 2da8e22.

📒 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 = 0 and gcTime = 0 as 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 gcTime option is correctly forwarded to the useQuery configuration, completing the cache disabling implementation alongside the staleTime setting.

Copy link
Member

@MartinSchoeler MartinSchoeler left a 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?

@aleksandernsilva aleksandernsilva added the stat: QA assured Means it has been tested and approved by a company insider label Sep 19, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Sep 19, 2025
@kodiakhq kodiakhq bot merged commit e8b9f27 into develop Sep 20, 2025
47 of 48 checks passed
@kodiakhq kodiakhq bot deleted the fix/outbound-providers-cache branch September 20, 2025 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants