-
Notifications
You must be signed in to change notification settings - Fork 13k
fix: multiple stream subscribe after reconnection #36263
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: a4133b8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 37 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 |
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release-7.8.0 #36263 +/- ##
=================================================
- Coverage 64.57% 64.56% -0.01%
=================================================
Files 3147 3147
Lines 104580 104614 +34
Branches 19763 19758 -5
=================================================
+ Hits 67532 67549 +17
- Misses 34365 34382 +17
Partials 2683 2683
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
48c58f7 to
ace9838
Compare
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.
Pull Request Overview
This PR fixes duplicate stream subscriptions after reconnection by returning and tracking stream unsubscriptions, ensuring listeners are torn down before re-init.
- Refactored
setupListenerin cached collections to return subscription handles. - Introduced
init/releasepairing with aninitializationPromiseto prevent multiple subscriptions. - Adjusted
DocumentMapStoreto push modified records toonInvalidateand added cleanup in a React hook.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/meteor/client/lib/settings/PrivateSettingsCachedCollection.ts | Override setupListener to return the stream subscription for later cleanup |
| apps/meteor/client/lib/cachedCollections/DocumentMapStore.ts | Move onInvalidate to use the modifier’s returned record instead of the original |
| apps/meteor/client/lib/cachedCollections/CachedCollection.ts | Refactor init, add release, track initializationPromise, and teardown listener |
| apps/meteor/client/hooks/useLoadRoomForAllowedAnonymousRead.ts | Add cleanup return in useEffect to reset ready flags |
| .changeset/light-beans-sparkle.md | Add patch changeset describing the stream subscription fix |
Comments suppressed due to low confidence (1)
apps/meteor/client/lib/cachedCollections/CachedCollection.ts:332
- Changing
initfrom returning the subscription directly to returning aPromise<void>is a breaking API change. Consumers expecting the subscription handle may now fail—consider documenting this change or providing an alternate method.
init() {
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
https://rocketchat.atlassian.net/browse/ARCH-1665
Proposed changes (including videos or screenshots)
Issue(s)
Steps to test or reproduce
Further comments