Skip to content

Fix Submit plan welcome modal: navigate to existing Submit workspace and remove double bottom safe-area padding#96459

Open
abzokhattab wants to merge 1 commit into
Expensify:mainfrom
abzokhattab:fix/submit-plan-modal-96121-96123
Open

Fix Submit plan welcome modal: navigate to existing Submit workspace and remove double bottom safe-area padding#96459
abzokhattab wants to merge 1 commit into
Expensify:mainfrom
abzokhattab:fix/submit-plan-modal-96121-96123

Conversation

@abzokhattab

@abzokhattab abzokhattab commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Fixes the two bugs reported against the Submit plan welcome modal introduced in #95099.

1. Home page opens after clicking "Get the free plan" when a Submit workspace already exists (#96123)

When the modal is opened again (via the /workspaces/submit-plan-welcome deep link) after a Submit workspace was already created, useAutoCreateSubmitWorkspace skips workspace creation (hasEditableGroupPolicy is true) and falls back to onboardingPolicyID, which is empty for an already-onboarded user. navigateToSubmitWorkspaceAfterOnboarding then receives undefined and lands on Home.

Fix: add a second policy-collection selector that resolves the ID of the user's existing editable Submit workspace, and use it as the navigation fallback. The fallback is scoped to already-onboarded callers (shouldCompleteOnboarding === false, i.e. only the welcome modal): the three onboarding call sites (BaseOnboardingPurpose, BaseOnboardingPersonalDetails, BaseOnboardingWorkspaces) keep their exact current behavior, and the completeOnboarding payload is untouched, so there is no regression surface for the onboarding flows.

2. Free plan modal shows empty space at the bottom on Android (#96121)

The bottom safe-area inset was applied twice on devices with a bottom inset (e.g. Android gesture bar): once by CenteredModalLayout's content wrapper (via useBottomSafeSafeAreaPaddingStyle, which adds the inset on top of the modal's zeroed pb0), and once by FeatureTrainingContent's ScrollView content padding (getScrollableFeatureTrainingModalStyles = pb5 + inset). The result was a pb5 + 2×inset empty band under the buttons — invisible on web where the inset is 0.

Fix: add an addBottomSafeAreaPadding prop (default true) to CenteredModalLayout so consumers whose children already handle the inset can opt out, and pass false from SubmitPlanWelcomeModal. Existing consumers are unaffected by default. Note: MigratedUserWelcomeModal, AutoSubmitModal, and ChangePolicyEducationalModal use the same pattern and share this latent double-inset; they can opt in via the same prop in a follow-up once verified on device.

Also adds two unit tests covering the navigation fallback (modal path navigates to the existing Submit workspace; onboarding path behavior unchanged).

Fixed Issues

$ #96121
$ #96123
PROPOSAL:

Tests

#96123 — navigation to existing Submit workspace:

  1. Enable the SUBMIT_2026 beta for your account.
  2. Log in with an account that has no workspaces, open any chat, and send the link https://dev.new.expensify.com:8082/workspaces/submit-plan-welcome.
  3. Click the link and click Get the free plan. Verify a Submit workspace is created and you land on Workspace → Categories.
  4. Go back to the chat, click the same link again, and click Get the free plan.
  5. Verify you are taken to the Categories page of the existing Submit workspace (not the Home page), and no duplicate workspace is created.

#96121 — no empty space at the bottom (Android):

  1. On an Android device with gesture navigation (bottom inset), open any chat and send the link https://dev.new.expensify.com:8082/workspaces/submit-plan-welcome.
  2. Tap the link.
  3. Verify the modal shows no empty band below the "Get the free plan" / "No thanks" buttons.
  4. On web/desktop, verify the modal layout is unchanged.

Offline tests

  1. With an account that already has a Submit workspace, go offline.
  2. Open the modal via the deep link and tap Get the free plan.
  3. Verify you are navigated to the existing Submit workspace's Categories page and no duplicate workspace is created optimistically.

QA Steps

Same as tests.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen.Recording.2026-07-19.at.18.00.48.mov
Android: mWeb Chrome
iOS: Native
Screen.Recording.2026-07-19.at.17.58.25.mov
iOS: mWeb Safari
Screen.Recording.2026-07-19.at.17.59.46.mov
MacOS: Chrome / Safari
Screen.Recording.2026-07-19.at.17.52.32.mov

Fixes two issues reported against the Submit plan welcome modal:

- Navigate to the existing Submit workspace instead of Home when an
  already-onboarded user confirms the modal while an editable Submit
  workspace already exists (Expensify#96123). The fallback is scoped to callers
  that skip onboarding completion so the onboarding flows are untouched.
- Stop applying the bottom safe-area inset twice on Android by letting
  CenteredModalLayout consumers opt out of the wrapper inset when their
  content (FeatureTrainingContent's ScrollView) already includes it,
  removing the empty band under the modal buttons (Expensify#96121).
@abzokhattab
abzokhattab marked this pull request as ready for review July 19, 2026 16:08
@abzokhattab
abzokhattab requested review from a team as code owners July 19, 2026 16:08
@melvin-bot
melvin-bot Bot requested review from a team, joekaufmanexpensify and mkhutornyi and removed request for a team July 19, 2026 16:08
@melvin-bot

melvin-bot Bot commented Jul 19, 2026

Copy link
Copy Markdown

@mkhutornyi 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]

@melvin-bot
melvin-bot Bot requested review from heyjennahay and removed request for a team July 19, 2026 16:08
@abzokhattab

Copy link
Copy Markdown
Contributor Author

this is ready for review @hungvu193

@hungvu193
hungvu193 requested review from hungvu193 and removed request for mkhutornyi July 19, 2026 16:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0504da1c11

ℹ️ 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".

);
const [hasEditableGroupPolicy] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: groupPolicySelector});
const existingSubmitPolicyIDSelector = useMemo(
() => (policies: OnyxCollection<Policy>) => Object.values(policies ?? {}).find((policy) => isSubmitPolicy(policy) && canEditWorkspaceSettings(policy))?.id,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass the login when resolving the Submit workspace

When the policy collection has a partially loaded Submit policy without top-level role (the case canEditWorkspaceSettings(policy, login) supports via employeeList[currentUserEmail].role), this selector returns undefined even though the user can edit the workspace. For an already-onboarded modal invocation that skips creation because another editable group policy is present, the fallback still passes no policy ID and navigates Home instead of the existing Submit workspace. Pass currentUserEmail here and include it in the memo dependencies.

Useful? React with 👍 / 👎.

@joekaufmanexpensify joekaufmanexpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing Deploy Blockers

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.

2 participants