fix(react-native): cancel prior iOS Combine sinks before re-subscribing (FR-25940) - #96
Closed
dianaKhortiuk-frontegg wants to merge 1 commit into
Closed
fix(react-native): cancel prior iOS Combine sinks before re-subscribing (FR-25940)#96dianaKhortiuk-frontegg wants to merge 1 commit into
dianaKhortiuk-frontegg wants to merge 1 commit into
Conversation
…ng (FR-25940) Each FronteggWrapper mount calls listener() -> FronteggRN.subscribe(), which added two Combine sinks to cancellables on every call and never cancelled them (stopObserving only flips a flag). N remounts meant N x duplicate native event work per state change, masked only by the 50 ms JS debounce. Cancel and clear cancellables at the start of subscribe(), mirroring Android which disposes the prior subscription before re-subscribing.
Collaborator
Author
|
Superseded by #100, which combines FR-25937/38/39/40 into a single PR. Branch kept. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FR-25940 — iOS listener leak:
subscribe()accumulates Combine sinks on every re-mountEach
FronteggWrappermount callslistener()→FronteggRN.subscribe().subscribe()added two new sinks tocancellableson every call and never cancelled them —stopObserving()only flipshasListeners. So N remounts meant N× duplicate native event work per state change, masked only by the 50 ms JS debounce. Android already disposes the prior subscription before re-subscribing.Fix
Cancel and clear
cancellablesat the start ofsubscribe(), mirroring Android's dispose-before-subscribe.Note
iOS-only; verified via
swiftc -parse. Not compiled in a full iOS build here (no iOS build harness) — please let CI confirm.