Close saved-payment-method confirmation interactors when they leave composition - #13774
Draft
jaynewstrom-stripe wants to merge 1 commit into
Draft
Close saved-payment-method confirmation interactors when they leave composition#13774jaynewstrom-stripe wants to merge 1 commit into
jaynewstrom-stripe wants to merge 1 commit into
Conversation
jaynewstrom-stripe
force-pushed
the
jaynewstrom/dispose-saved-payment-confirm-interactors
branch
from
August 5, 2026 20:40
59fa20e to
7235b26
Compare
jaynewstrom-stripe
force-pushed
the
jaynewstrom/dispose-saved-payment-confirm-interactors
branch
2 times, most recently
from
August 5, 2026 22:00
21d1401 to
2cb9f9a
Compare
jaynewstrom-stripe
force-pushed
the
jaynewstrom/dispose-saved-payment-confirm-interactors
branch
from
August 5, 2026 23:12
2cb9f9a to
8a70e12
Compare
Base automatically changed from
jaynewstrom/scope-vertical-pm-list-interactors
to
master
August 6, 2026 15:14
jaynewstrom-stripe
force-pushed
the
jaynewstrom/dispose-saved-payment-confirm-interactors
branch
3 times, most recently
from
August 6, 2026 22:55
36f5282 to
fe6391c
Compare
Committed-By-Agent: codex Co-authored-by: codex <noreply@openai.com>
jaynewstrom-stripe
force-pushed
the
jaynewstrom/dispose-saved-payment-confirm-interactors
branch
from
August 6, 2026 23:09
fe6391c to
d67caef
Compare
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
SavedPaymentMethodConfirmInteractornow exposesclose(), which cancels its internal selection-collecting job.PaymentSheetScreen.SavedPaymentMethodConfirmimplementsCloseableand delegates to it. In the embedded form,FormScreenContentnowremembers the interactor keyed on the selection being confirmed and closes it viaDisposableEffectwhen it leaves composition or the selection changes.Motivation
DefaultSavedPaymentMethodConfirmInteractorlaunched acoroutineScope.launch { selection.collectLatest { updateSelection(it) } }job ininitwith no way to stop it — every time the saved-payment confirmation screen/composable was shown, that collector leaked for the life of the underlying scope. This adds an explicit disposal hook and wires it up at both places the interactor is created: the standalonePaymentSheetScreen.SavedPaymentMethodConfirmscreen and the embeddedFormActivityUI'sFormScreenContentcomposable.Testing
Added tests
Modified tests
Manually verified
Added a
DefaultSavedPaymentMethodConfirmInteractorTestcase verifying that afterclose(), selection updates stop being delivered. Wired aCleanupTestRuleso every interactor built by the test helper gets closed during test cleanup.Added
FormScreenContentTestcovering theremember/DisposableEffectsemantics in the embedded form: the interactor is reused across unrelated recompositions of the same selection, closed exactly once when the confirmation is dismissed, and recreated (with the old one closed) when the selection changes.Added a
PaymentSheetScreentest verifyingSavedPaymentMethodConfirm.close()delegates to the interactor'sclose().FakeSavedPaymentMethodConfirmInteractorgot a no-opclose()to satisfy the interface.Screenshots
N/A — no visual changes.