Fix paywall Add payment card CTA navigation race in restricted action#91509
Fix paywall Add payment card CTA navigation race in restricted action#91509neerajbachani wants to merge 3 commits into
Conversation
Use dismissModal with afterTransition for web/native owner CTA to avoid modal-stack race, and add regression tests for web and native routes.
|
@thelullabyy Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9aa78e5b2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| Navigation.dismissModal({ | ||
| afterTransition: () => Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION_ADD_PAYMENT_CARD), |
There was a problem hiding this comment.
Preserve underlying RHP flow before navigating to billing
Switching from Navigation.closeRHPFlow() to Navigation.dismissModal() changes behavior from “pop only the top RHP flow” to “pop the entire RIGHT_MODAL navigator,” so users who open this paywall from a multi-step modal flow (e.g., expense creation) lose their in-progress stack when they tap the CTA. closeRHPFlow was designed to keep prior RHP routes when more than one exists, but dismissModal always dismisses the modal route itself, so back navigation can no longer return to the interrupted flow.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
agreed, this is better, Preserves underlying multi-step RHP flow semantics ( closeRHPFlow ) , Still avoids the navigation race ( waitForTransition ), code updated.
Use closeRHPFlow with waitForTransition navigation for web/native owner CTAs to avoid modal-stack race without dismissing the full modal stack, and add regression tests.
|
okay @codex review again, make no mistakes |
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Use dismissModal with afterTransition for web/native owner CTA to avoid modal-stack race, and add regression tests for web and native routes.
Explanation of Change
The workspace owner paywall CTA was calling
Navigation.closeRHPFlow()and immediately callingNavigation.navigate(...). That dispatches two navigation actions in the same tick while the RHP/modal stack is still transitioning, which can drop the follow-up navigation and make the button appear to do nothing.This PR keeps the existing UX unchanged (web still shows Add payment card and routes to the add-card screen; native still shows Go to Subscription and routes to subscription settings). It only fixes navigation sequencing by using
Navigation.dismissModal({ afterTransition: () => Navigation.navigate(...) })in both platform handlers, and adds unit tests to lock in web/native behavior.Fixed Issues
$ #89718
PROPOSAL: #89718 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari