fix: invalidate React Query cache on DDP reconnection - #41337
fix: invalidate React Query cache on DDP reconnection#41337prathamesh04 wants to merge 1 commit into
Conversation
…ls and infinite lists
|
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: 27b25f4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📜 Recent review details⏰ Context from checks skipped due to timeout. (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
🧠 Learnings (6)📚 Learning: 2026-03-16T21:50:37.589ZApplied to files:
📚 Learning: 2026-02-10T16:32:42.586ZApplied to files:
📚 Learning: 2026-05-11T20:30:35.265ZApplied to files:
📚 Learning: 2026-02-26T19:25:44.063ZApplied to files:
📚 Learning: 2026-02-26T19:25:44.063ZApplied to files:
📚 Learning: 2026-05-06T12:21:44.083ZApplied to files:
🔇 Additional comments (2)
WalkthroughThe reconnect synchronization hook now invalidates React Query caches for opened rooms after loading missed messages, refreshing thread and message list data. A patch changeset documents the update for ChangesReconnect cache synchronization
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
|
This PR is ready for review — @RocketChat/backend could you take a look? |
|
Hi @julio-rocketchat, could you please take a look when you get a chance? Thanks! |
Description
Fixes issue #41190: Open thread panels and infinite message lists do not refresh with missed messages after a DDP-only reconnection.
Root cause
On DDP reconnection, the hook correctly calls to sync new messages into the Dexie/Memory cache. However, React Query caches (used by thread panels via and infinite message lists via ) are never invalidated, so the UI does not refetch to display the newly synced messages.
Fix
After calling for each opened room on reconnect, invalidate all React Query caches under
roomsQueryKeys.room(rid). This single invalidation covers thread messages, discussion messages, infinite message lists, pinned/starred messages, and all other room-scoped queries — since they are all nested children ofroomsQueryKeys.room(rid).Changes
apps/meteor/client/views/root/hooks/useLoadMissedMessages.ts: AddqueryClient.invalidateQueries({ queryKey: roomsQueryKeys.room(rid) })per opened room in the reconnect effect.Closes #41190
Summary by CodeRabbit