Fix BatchRemovingTransitionContext completion being called multiple times#191
Draft
Fix BatchRemovingTransitionContext completion being called multiple times#191
Conversation
…imes When multiple StackingPlatterViews shared the same BatchRemovingTransitionContext, each swapTransitionContext call would invoke invalidate() on the shared context, causing completion callbacks to fire N times instead of once. Changes: - Add hasNotifiedCompletion flag to ensure callbacks fire exactly once - Add isInvalidated/isCompleted guard to notifyCompleted() (matching RemovingTransitionContext) - Add isInvalidated guard in onCompleted closure (matching _startRemoving pattern) - Add tests verifying completion is called exactly once Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove hasNotifiedCompletion flag, use isInvalidated guard instead - Use XCTestExpectation for async batch transition test (crossDissolve) - Place stack in UIWindow so animation completes properly Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e and transitionSucceeded Ensures callbacks fire exactly once regardless of which path triggers first. Both invalidate() and transitionSucceeded() check and set the flag before firing callbacks, preventing re-entry from either direction. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Prevent re-entry between invalidate(), transitionSucceeded(), and notifyCancelled() so callbacks fire exactly once. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
BatchRemovingTransitionContextcompletion callbacks firing multiple times when multipleStackingPlatterViews share the same contexthasNotifiedCompletionflag to ensure callbacks fire exactly once (viainvalidate(),transitionSucceeded(), ornotifyCompleted())isInvalidatedguard inonCompletedclosure, matching the existing_startRemovingpattern inRemovingTransitionContextTest plan
testBatchRemovingCompletionCalledOnce— verifiesremoveViewControllerbatch path calls completion exactly oncetestRemoveAllViewControllerCompletionCalledOnce— verifiesremoveAllViewControllercalls completion exactly once🤖 Generated with Claude Code