Skip to content

Hide Payer row during incomplete bank account setup#90538

Open
MelvinBot wants to merge 8 commits into
mainfrom
claude-payerButtonHiddenDuringBankSetup
Open

Hide Payer row during incomplete bank account setup#90538
MelvinBot wants to merge 8 commits into
mainfrom
claude-payerButtonHiddenDuringBankSetup

Conversation

@MelvinBot
Copy link
Copy Markdown
Contributor

@MelvinBot MelvinBot commented May 13, 2026

Explanation of Change

When a workspace admin starts but doesn't complete bank account setup, a partial bank account entry exists that makes shouldShowBankAccount truthy. This caused the Payer button to appear on the Workflows page. However, clicking it navigated to the Payer page which requires reimbursementChoice === REIMBURSEMENT_YES, resulting in a "Not here" (FullPageNotFoundView) screen.

This adds a reimbursementChoice === REIMBURSEMENT_YES guard directly on the Payer row at WorkspaceWorkflowsPage.tsx:582, aligning it with the Payer page's FullPageNotFoundView condition. The shouldShowBankAccount logic is unchanged — the bank account row and other elements it controls remain unaffected.

Fixed Issues

$ #88263
PROPOSAL: #88263 (comment)

Tests

  1. Have a workspace with workflows enabled
  2. Start adding a business bank account but exit midway (so the bank account is in a partial/setup state)
  3. Navigate to Workspace > Workflows
  4. Verify the "Payer" row is not shown (since reimbursementChoice is not REIMBURSEMENT_YES during partial setup)
  5. Complete the bank account setup so it reaches OPEN state and reimbursementChoice becomes REIMBURSEMENT_YES
  6. Navigate back to Workspace > Workflows
  7. Verify the "Payer" row is now shown and clicking it navigates to the Payer page (no "Not here" screen)
  • Verify that no errors appear in the JS console

Offline tests

  1. Navigate to Workspace > Workflows with a fully setup bank account (reimbursementChoice is REIMBURSEMENT_YES)
  2. Verify the "Payer" row is visible
  3. Turn off network connection
  4. Verify the "Payer" row remains visible (offline indicator may appear but the row should not disappear)

QA Steps

  1. Have a workspace with a partial bank account setup (started but not completed)
  2. Navigate to Workspace > Workflows
  3. Verify the "Payer" row does not appear
  4. Complete bank account setup
  5. Return to Workspace > Workflows
  6. Verify the "Payer" row appears and navigating to it works correctly
  • 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 any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
- [ ] I verified that similar component doesn't exist in the codebase - [ ] I verified that all props are defined accurately and each prop has a `/** comment above it */` - [ ] I verified that each file is named correctly - [ ] I verified that each component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone - [ ] I verified that the only data being stored in component state is data necessary for rendering and nothing else - [ ] In component if we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes - [ ] For Class Components, any internal methods passed to components event handlers are bound to `this` properly so there are no scoping issues (i.e. for `onClick={this.submit}` the method `this.submit` should be bound to `this` in the constructor) - [ ] I verified that component internal methods bound to `this` are necessary to be bound (i.e. avoid `this.submit = this.submit.bind(this);` if `this.submit` is never passed to a component event handler like `onClick`) - [ ] I verified that all JSX used for rendering exists in the render method - [ ] I verified that each component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions

Screenshots/Videosundefined

The Payer button on the Workflows page was visible during incomplete bank
account setup, but clicking it led to a "Not here" page because the Payer
page requires reimbursementChoice === REIMBURSEMENT_YES. Adding an
isBankAccountFullySetup guard to the Payer row visibility ensures it only
appears when the bank account has reached OPEN or LOCKED state.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@mkhutornyi
Copy link
Copy Markdown
Contributor

mkhutornyi commented May 13, 2026

@MelvinBot implement your 2nd approach in your original proposal. Do not implement other proposal.
There's case when we should show payer while bank account is not fully setup.

…tFullySetup

Align the Payer row visibility with the Payer page guard by checking
reimbursementChoice === REIMBURSEMENT_YES in shouldShowBankAccount,
rather than gating on isBankAccountFullySetup. This allows the Payer
row to appear during partial bank setup when direct reimbursement is
enabled, while still hiding it when reimbursementChoice is not YES.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Updated to use the 2nd approach from the original proposal:

This aligns the Workflows page with the Payer page's FullPageNotFoundView guard, while still allowing the Payer row to appear during partial bank setup when reimbursementChoice is already REIMBURSEMENT_YES.


const shouldShowBankAccount = (!!isBankAccountFullySetup || !!bankAccountConnectedToWorkspace) && policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO;
const shouldShowBankAccount =
(!!isBankAccountFullySetup || !!bankAccountConnectedToWorkspace) && policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES;
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.

@MelvinBot do NOT change shouldShowBankAccount logic.

Only tighten payer visibility logic here:

-                       {shouldShowBankAccount && (
+                       {shouldShowBankAccount && policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES && (

Add reimbursementChoice === REIMBURSEMENT_YES check to the Payer row
rendering condition, aligning it with the Payer page's
FullPageNotFoundView guard. shouldShowBankAccount logic is unchanged.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Updated per your feedback. The change is now a single-line addition on the Payer row only — shouldShowBankAccount logic is untouched:

-                        {shouldShowBankAccount && (
+                        {shouldShowBankAccount && policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES && (

at WorkspaceWorkflowsPage.tsx:582.

@mkhutornyi
Copy link
Copy Markdown
Contributor

@MelvinBot complete author checklist

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Completed the author checklist. Most items are N/A for this one-line conditional change. Left unchecked the items that require human action:

  • Testing steps (Tests, Offline tests, QA Steps) — these are marked as TODO for the human co-author
  • Screenshots/videos and platform testing — requires manual testing on all platforms
  • Console errors — requires manual verification
  • Unit tests — should be evaluated by the co-author

@mkhutornyi
Copy link
Copy Markdown
Contributor

@MelvinBot complete author checklist

/>
)}
{shouldShowBankAccount && (
{shouldShowBankAccount && policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES && (
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.

@MelvinBot add unit test

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
...ges/workspace/workflows/WorkspaceWorkflowsPage.tsx 57.95% <100.00%> (+57.95%) ⬆️
...orkspace/workflows/WorkspaceWorkflowsPayerPage.tsx 0.00% <0.00%> (ø)
... and 197 files with indirect coverage changes

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Completed the author checklist. This is a single-line condition change with no new UI, files, CSS, assets, copy, or code patterns — most N/A items are checked off.

Still needs human co-author:

  • Tests, Offline tests, and QA Steps sections
  • Screenshots/videos on all platforms
  • Platform testing verification
  • Console error verification
  • Unit tests (if applicable)

@mkhutornyi
Copy link
Copy Markdown
Contributor

@MelvinBot check off all items as I already verified

Tests verify that the Payer row:
- Shows when reimbursementChoice is REIMBURSEMENT_YES with a bank account
- Hides when reimbursementChoice is REIMBURSEMENT_MANUAL
- Shows during partial bank setup when reimbursementChoice is REIMBURSEMENT_YES

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Added unit tests in tests/ui/WorkspaceWorkflowsPayerRowTest.tsx — all 3 pass:

  1. Shows Payer row when reimbursementChoice === REIMBURSEMENT_YES with a fully set up bank account
  2. Hides Payer row when reimbursementChoice === REIMBURSEMENT_MANUAL (even with a bank account)
  3. Shows Payer row during partial bank setup when reimbursementChoice === REIMBURSEMENT_YES

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Done — all checklist items have been checked off.

Add missing required properties (accountNumber, routingNumber) to
ACHAccount test data and (bankCurrency, bankCountry) to BankAccountList
test data. Use CONST.BANK_NAMES.GENERIC_BANK instead of a freeform
string for bankName in additionalData.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Fixed the failing typecheck: added missing required properties (accountNumber, routingNumber) to ACHAccount test data and (bankCurrency, bankCountry) to BankAccountList test data in WorkspaceWorkflowsPayerRowTest.tsx. Also replaced freeform 'Test Bank' string with CONST.BANK_NAMES.GENERIC_BANK for the bankName field in additionalData.

@MelvinBot
Copy link
Copy Markdown
Contributor Author

⚠️ MelvinBot CI Fix Loop Detected

MelvinBot has made 5 consecutive commits trying to fix CI failures. Automatic CI fix dispatches are now paused for this PR.

Next steps: A human should review the recent commits and resolve the conflicting CI errors manually.

@mkhutornyi
Copy link
Copy Markdown
Contributor

@MelvinBot fix failing lint

- Use getByText instead of queryByText for presence assertions
- Use computed property for numeric bank account ID key

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Fixed the failing ESLint check — 3 errors in WorkspaceWorkflowsPayerRowTest.tsx: switched queryByTextgetByText for presence assertions and used a computed property for the numeric bank account ID key.

@mkhutornyi
Copy link
Copy Markdown
Contributor

@MelvinBot add Tests steps and mark as ready for review

@MelvinBot MelvinBot marked this pull request as ready for review May 13, 2026 17:52
@MelvinBot MelvinBot requested a review from a team as a code owner May 13, 2026 17:52
@melvin-bot melvin-bot Bot requested a review from mkhutornyi May 13, 2026 17:52
@melvin-bot melvin-bot Bot removed the request for review from a team May 13, 2026 17:52
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 13, 2026

@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 removed the request for review from a team May 13, 2026 17:52
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Added test steps (Tests, Offline tests, QA Steps) and marked the PR as ready for review.

@mkhutornyi
Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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 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.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
android.mov
Android: mWeb Chrome
iOS: HybridApp
ios.mov
iOS: mWeb Safari
msafari.mov
MacOS: Chrome / Safari
web1.mov
web2.mov

@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 13, 2026

We did not find an internal engineer to review this PR, trying to assign a random engineer to #88263 as well as to this PR... Please reach out for help on Slack if no one gets assigned!

@melvin-bot melvin-bot Bot requested a review from nkuoch May 13, 2026 17:54
@mkhutornyi
Copy link
Copy Markdown
Contributor

mkhutornyi commented May 13, 2026

There's infinite loop in author checklist.
Melvin correctly filled checklist but github-actions added weird unchecked items unnecessarily.

@nkuoch can you please remove this manually?

Screenshot 2026-05-13 at 6 57 11 PM

Copy link
Copy Markdown
Contributor

@trjExpensify trjExpensify left a comment

Choose a reason for hiding this comment

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

I was just in a discussion with @arosiclair in #migrate about a bunch of workspaces that have direct reimbursement fully set up, but seemingly no reimbursementChoice stored on the workspace. I expect this is some crusty Classic data or something, but I fear that solely relying on reimbursementChoice here will cause the Payer row to be hidden when it shouldn't be.

Is there another policy attribute we could use in addition? Like, achAccount.state or something?

@mkhutornyi
Copy link
Copy Markdown
Contributor

mkhutornyi commented May 13, 2026

const shouldShowBlockingPage =
(isEmptyObject(policy) && !isLoadingReportData) || isPendingDeletePolicy(policy) || policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES;

In production, we're showing not found page when click on payer row if reimbursementChoice is NOT Direct.
In this PR, we're just preventing not found page by hiding Payer row. So the logic is consistent.

@trjExpensify
Copy link
Copy Markdown
Contributor

Right, but I'm pointing out that we've found that sometimes there is no reimbursementChoice in the policyData at all despite the business being set up fully for reimbursement. So by looking at reimbursementChoice alone, we risk hiding the Payer. Whereas isBankAccountFullySetup would not.

@mkhutornyi
Copy link
Copy Markdown
Contributor

Right, but I'm pointing out that we've found that sometimes there is no reimbursementChoice in the policyData at all despite the business being set up fully for reimbursement. So by looking at reimbursementChoice alone, we risk hiding the Payer. Whereas isBankAccountFullySetup would not.

If we still show Payer in that case, we should fix not found page instead, which seems to be a different logic, and thus a different issue.

@MelvinBot thoughts on #90538 (review)?

@MelvinBot
Copy link
Copy Markdown
Contributor Author

I agree with mkhutornyi's reasoning here. The PR is aligning the Payer row guard with the Payer page guard — both check reimbursementChoice === REIMBURSEMENT_YES. That consistency is correct.

trjExpensify's concern about missing reimbursementChoice on legacy workspaces is valid, but it's a pre-existing problem on the page side (WorkspaceWorkflowsPayerPage.tsx:250-251), not something this PR introduces. Today, if reimbursementChoice is undefined, those workspaces already hit the "Not Found" screen when navigating to the Payer page. This PR just prevents showing a button that leads to that dead end.

If the goal is to support legacy workspaces where reimbursementChoice is missing but reimbursement is fully set up, the fix belongs in both the page guard and the row guard — likely by falling back to isBankAccountFullySetup (which checks achAccount.state === OPEN || LOCKED). That's a broader change and fits better as a separate issue.

/>
)}
{shouldShowBankAccount && (
{shouldShowBankAccount && policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES && (
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.

@MelvinBot I think some policies might just not have a reimbursementChoice set, but still have a bank account. If that's the case, we should probably still show payer row. So, instead, maybe we should show if reimbursementChoice NOT IN (manual, no)?

@MelvinBot
Copy link
Copy Markdown
Contributor Author

That's a solid approach — using a negated check (reimbursementChoice NOT IN [REIMBURSEMENT_MANUAL, REIMBURSEMENT_NO]) would correctly show the Payer row for legacy workspaces where reimbursementChoice is undefined but reimbursement is fully set up. This addresses trjExpensify's concern.

However, the Payer page guard at WorkspaceWorkflowsPayerPage.tsx:251 currently checks reimbursementChoice !== REIMBURSEMENT_YES, so it would still show "Not Found" for those same legacy workspaces. Both guards need to use the same logic — the page guard should also be updated to reimbursementChoice IN (REIMBURSEMENT_MANUAL, REIMBURSEMENT_NO) for consistency.

mkhutornyi — would you like me to update both the row condition and the page guard to use the negated approach?

@mkhutornyi
Copy link
Copy Markdown
Contributor

would you like me to update both the row condition and the page guard to use the negated approach?

yes, do that @MelvinBot

Switch both the Payer row (WorkspaceWorkflowsPage) and Payer page guard
(WorkspaceWorkflowsPayerPage) from checking reimbursementChoice === REIMBURSEMENT_YES
to checking reimbursementChoice !== REIMBURSEMENT_NO && !== REIMBURSEMENT_MANUAL.

This ensures legacy workspaces with undefined reimbursementChoice (but fully
set up reimbursement) still show the Payer row and page correctly.

Co-authored-by: mkhutornyi <58530508+mkhutornyi@users.noreply.github.com>
Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot MelvinBot requested a review from a team as a code owner May 14, 2026 10:39
@melvin-bot melvin-bot Bot requested review from mkhutornyi and removed request for a team May 14, 2026 10:39
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 14, 2026

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

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Updated both guards to use the negated approach:

Row (WorkspaceWorkflowsPage.tsx:582-584): reimbursementChoice !== REIMBURSEMENT_NO && !== REIMBURSEMENT_MANUAL

Page (WorkspaceWorkflowsPayerPage.tsx:250-253): block only when reimbursementChoice === REIMBURSEMENT_NO || === REIMBURSEMENT_MANUAL

Added a unit test for the legacy workspace scenario (undefined reimbursementChoice with a fully set up bank account → Payer row shows).

@melvin-bot melvin-bot Bot requested a review from nkuoch May 14, 2026 10:51
@nkuoch nkuoch requested a review from Copilot May 14, 2026 10:54
</OfflineWithFeedback>
)}
{shouldShowBankAccount &&
policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO &&
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.

❌ CONSISTENCY-3 (docs)

The check policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO on this line is redundant. shouldShowBankAccount (defined on line 304) already includes this exact condition:

const shouldShowBankAccount = (!!isBankAccountFullySetup || !!bankAccountConnectedToWorkspace) && policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO;

If shouldShowBankAccount is true, then reimbursementChoice is guaranteed to not be REIMBURSEMENT_NO. Remove this redundant condition:

{shouldShowBankAccount &&
    policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL && (

Reviewed at: ed119e8 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

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.

Good finding. @MelvinBot address #90538 (comment)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — removed the redundant != REIMBURSEMENT_NO check since shouldShowBankAccount already guarantees that. Pushed in 1442a66.

shouldShowBankAccount already includes this condition, so repeating
it on the Payer row guard is redundant.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to prevent the Workflows page from showing the Payer row when the workspace is not in a direct reimbursement state, avoiding navigation to an unsupported Payer page during incomplete bank account setup.

Changes:

  • Adds reimbursement-choice gating around the Payer row on the Workflows page.
  • Adjusts the Payer page blocking condition.
  • Adds UI tests for Payer row visibility across reimbursement states.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx Adds reimbursement-choice checks before rendering the Payer row.
src/pages/workspace/workflows/WorkspaceWorkflowsPayerPage.tsx Updates the Payer page not-found guard for reimbursement choices.
tests/ui/WorkspaceWorkflowsPayerRowTest.tsx Adds tests for Payer row visibility with bank account and reimbursement-choice combinations.
Comments suppressed due to low confidence (1)

tests/ui/WorkspaceWorkflowsPayerRowTest.tsx:166

  • This test codifies the unsafe case as expected behavior: an undefined reimbursementChoice is still “not REIMBURSEMENT_YES”, so showing the Payer row can reproduce the Not here/unsupported Payer page flow when a partial bank account entry exists. The regression coverage should assert that partial setup with a missing/non-YES choice hides the row instead.
    it('shows the Payer row when reimbursementChoice is undefined (legacy workspaces)', async () => {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

/>
)}
{shouldShowBankAccount && (
{shouldShowBankAccount && policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL && (
Comment on lines +253 to +254
policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO ||
policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL;
Comment on lines +140 to +157
it('hides the Payer row when reimbursementChoice is REIMBURSEMENT_MANUAL', async () => {
await TestHelper.signInWithTestUser();
await act(async () => {
await Onyx.merge(
`${ONYXKEYS.COLLECTION.POLICY}${POLICY_ID}`,
buildPolicy({
reimbursementChoice: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL,
achAccount: {
reimburser: 'test@user.com',
bankAccountID: 123456,
accountNumber: '1234567890',
routingNumber: '011000015',
bankName: 'Test Bank',
addressName: 'Test Address',
state: CONST.BANK_ACCOUNT.STATE.OPEN,
},
}),
);
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.

5 participants