Skip to content

Conversation

@ggazzo
Copy link
Member

@ggazzo ggazzo commented Jun 20, 2025

https://rocketchat.atlassian.net/browse/ARCH-1665

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Jun 20, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Jun 20, 2025

🦋 Changeset detected

Latest commit: a4133b8

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

This PR includes changesets to release 37 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-contexts 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/mock-providers Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/instance-status 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

@ggazzo ggazzo changed the base branch from develop to release-7.8.0 June 20, 2025 14:07
@ggazzo ggazzo added this to the 7.8.0 milestone Jun 20, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jun 20, 2025

PR Preview Action v1.6.1

🚀 View preview at
https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-36263/

Built to branch gh-pages at 2025-06-20 20:41 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@codecov
Copy link

codecov bot commented Jun 20, 2025

Codecov Report

Attention: Patch coverage is 82.97872% with 8 lines in your changes missing coverage. Please review.

Project coverage is 64.56%. Comparing base (c992f7d) to head (a4133b8).
Report is 2 commits behind head on release-7.8.0.

Additional details and impacted files

Impacted file tree graph

@@                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              
Flag Coverage Δ
e2e 57.65% <82.14%> (-0.02%) ⬇️
unit 69.16% <55.00%> (-0.01%) ⬇️

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.

@tassoevan tassoevan force-pushed the fix/multiple-subscribes branch from 48c58f7 to ace9838 Compare June 20, 2025 15:57
@ggazzo ggazzo marked this pull request as ready for review June 20, 2025 19:54
Copilot AI review requested due to automatic review settings June 20, 2025 19:54
@ggazzo ggazzo requested a review from a team as a code owner June 20, 2025 19:54
Copy link
Contributor

Copilot AI left a 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 setupListener in cached collections to return subscription handles.
  • Introduced init/release pairing with an initializationPromise to prevent multiple subscriptions.
  • Adjusted DocumentMapStore to push modified records to onInvalidate and 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 init from returning the subscription directly to returning a Promise<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>
@ggazzo ggazzo merged commit bff6b7d into release-7.8.0 Jun 20, 2025
72 of 74 checks passed
@ggazzo ggazzo deleted the fix/multiple-subscribes branch June 20, 2025 21:42
This was referenced Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants