Skip to content

Add imported vendor enable and disable controls - #102756

Merged
Beamanator merged 17 commits into
Expensify:mainfrom
ShridharGoel:vendor-matching-enable-disable
Oct 8, 2026
Merged

Beamanator merged 17 commits into
Expensify:mainfrom
ShridharGoel:vendor-matching-enable-disable

Conversation

@ShridharGoel

@ShridharGoel ShridharGoel commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Implements enable/disable controls and bulk actions for imported accounting vendors:

  1. Workspace Vendors page:
    • Added an enabled toggle column with Switch component and lock support.
    • Added multi-select checkbox mode with bulk Enable / Disable dropdown menu (ButtonWithDropdownMenu).
    • Locked the current default vendor toggle and excluded the default vendor from bulk disable actions.
    • Connected directly to the normalized policyVendors_{policyID} Onyx collection.
  2. Action Layer:
    • Added setPolicyVendorsEnabled calling SetPolicyVendorsEnabled with optimistic update, success merge, and failure rollback.
    • Added clearVendorErrors for error dismissal.
  3. Expense Vendor Picker (IOURequestStepVendor):
    • Excluded disabled vendors from search results and new expense selections.
    • Retained and visibly marked an existing assigned disabled vendor with a Disabled subtitle in the unsearched picker list, allowing the user to select an enabled replacement or clear with "None".

Fixed Issues

$ #98355
$ https://github.com/Expensify/Expensify/issues/678247
PROPOSAL: N/A

Tests

Automated Tests

  • Run npm run test -- tests/unit/PolicyVendorActionTest.ts tests/unit/PolicyUtilsTest.ts
  • Verify all unit tests pass.

Manual Tests

  1. Log in as an admin of a workspace connected to QuickBooks Online, Sage Intacct, Xero, Certinia, DualEntry, Rillet or Campfire with imported vendors.
  2. Ensure Vendor Matching beta is active, then navigate to Workspace Settings > Vendors.
  3. Verify all imported vendors are listed with an Enabled switch column.
  4. Locate the default vendor (e.g. default credit card vendor in QBO or charge vendor in Intacct):
    • Verify the switch is locked with a lock icon and cannot be toggled off.
  5. Toggle any non-default vendor off:
    • Verify the switch turns off immediately.
    • Verify that upon page refresh or network sync, the vendor remains disabled.
  6. Select multiple disabled vendors using row checkboxes:
    • Verify the bulk action button appears with "Enable vendor" or "Enable vendors".
    • Select the Enable option and verify all selected vendors become enabled.
  7. Select multiple enabled vendors (including the default vendor):
    • Verify the bulk action offers "Disable vendors".
    • Apply Disable and verify all selected vendors except the default vendor are disabled.
  8. Select a mixed set (some enabled, some disabled):
    • Verify both "Enable" and "Disable" options appear in the dropdown menu.
  9. Open an expense report on the workspace and edit an expense's vendor:
    • Verify disabled vendors do not appear in the vendor list or search results.
  10. If an expense was previously assigned to a vendor that was subsequently disabled:
    • Open the vendor picker on that expense.
    • Verify the assigned disabled vendor is listed as selected with a "Disabled" subtitle.
    • Search for the disabled vendor: verify it does not appear in search results.
    • Select an enabled vendor or select "None": verify the expense updates accordingly.
  • Verify that no errors appear in the JS console

Offline tests

  1. Open Workspace Settings > Vendors.
  2. Disconnect the network (offline mode).
  3. Toggle a vendor's Enabled switch.
  4. Verify the switch updates optimistically with a pending action indicator.
  5. Reconnect the network.
  6. Verify the pending indicator clears once the write command syncs.

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.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • 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

MacOS: Chrome / Safari
Screen.Recording.2026-10-02.at.1.10.52.AM.mov

@melvin-bot

melvin-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx bun ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx bun ./scripts/generateTranslations.ts --compare-ref main

@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/libs/API/types.ts 100.00% <ø> (ø)
src/libs/Violations/ViolationsUtils.ts 82.02% <100.00%> (+0.42%) ⬆️
src/libs/actions/IOU/UpdateMoneyRequest.ts 92.00% <ø> (-0.21%) ⬇️
src/libs/actions/Policy/Vendor.ts 100.00% <100.00%> (ø)
src/libs/PolicyUtils/vendor.ts 96.00% <97.22%> (+0.18%) ⬆️
.../components/Tables/WorkspaceVendorsTable/index.tsx 0.00% <0.00%> (ø)
...rc/pages/iou/request/step/IOURequestStepVendor.tsx 0.00% <0.00%> (ø)
...c/pages/workspace/vendors/WorkspaceVendorsPage.tsx 0.00% <0.00%> (ø)
... and 99 files with indirect coverage changes

@ShridharGoel
ShridharGoel marked this pull request as ready for review October 1, 2026 21:24
@ShridharGoel
ShridharGoel requested review from a team as code owners October 1, 2026 21:24
@melvin-bot
melvin-bot Bot requested review from Pujan92 and flaviadefaria and removed request for a team and flaviadefaria October 1, 2026 21:25
@melvin-bot

melvin-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown

@Pujan92 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 October 1, 2026 21:25
Comment thread src/pages/workspace/vendors/WorkspaceVendorsPage.tsx Outdated
Comment thread src/libs/actions/Policy/Vendor.ts
Comment thread src/types/onyx/PolicyVendor.ts Outdated
@Beamanator

Copy link
Copy Markdown
Contributor

@Pujan92 can you get to this today? 🙏

@Pujan92

Pujan92 commented Oct 2, 2026 •

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
  • 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 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 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 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)
  • 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.
  • 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: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-10-03.at.18.55.42.mov
Screen.Recording.2026-10-03.at.18.22.29.mov

@Pujan92

Pujan92 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

@codex review

@MelvinBot review

@MelvinBot

Copy link
Copy Markdown
Contributor

Review

The overall approach looks right. I found 3 issues worth fixing before merge, plus 2 smaller ones.

1. Vendors are no longer scoped to the active integration. Both IOURequestStepVendor.tsx:80 and WorkspaceVendorsPage.tsx:176 now render every entry in policyVendors_. The old getMatchingVendors(policy) only returned the active vendor-matching source. PolicyVendor has an origin field, so the collection can hold vendors from another connection. One example is a lingering Xero tenant, which the comment on isXeroVendorMatchingActive warns about. Users could then pick a vendor that goes inactive on the next sync. Suggest filtering by vendor.origin === getActiveVendorMatchingIntegration(policy). If the backend guarantees one origin per key, a short comment saying so would help.

2. Success data can briefly undo a newer toggle. Vendor.ts:47 spreads ...existing and sets enabled in successData. Example: toggle a vendor off, then quickly on. When the first request returns, its success data writes enabled: false over the second optimistic true. The switch flips back until the second request returns. setWorkspaceCategoriesEnabled only clears pendingAction, pendingFields.enabled, and errors on success. Doing the same here fixes it. In optimistic and failure data, write only the fields that change instead of spreading the snapshot. Failure data still needs to restore the old enabled value.

3. The page can show a spinner forever. WorkspaceVendorsPage.tsx:207 shows a loader while policyVendors === undefined. Nothing in App fetches this key. If the backend never writes it, for example when there are no vendors, the page never leaves the spinner. The empty state never shows either. Please confirm which read command populates policyVendors_, and fall back to the empty state if it can be missing.

Smaller items

  • IOURequestStepVendor.tsx:78: a vendor that isn't in policyVendors is labeled "Disabled". That covers both a vendor removed from the integration and a list that hasn't loaded yet. Consider marking only currentVendor?.enabled === false as disabled.
  • IOURequestStepVendor.tsx:64: policy?.id can build the key policyVendors_undefined. Use getNonEmptyStringOnyxID(policy?.id) like the other subscriptions in this file.

view run

@Pujan92

Pujan92 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Plz add id pujan0707+99790@gmail.com for the vendors beta

@Pujan92

Pujan92 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor
  1. The page can show a spinner forever. WorkspaceVendorsPage.tsx:207 shows a loader while policyVendors === undefined. Nothing in App fetches this key. If the backend never writes it, for example when there are no vendors, the page never leaves the spinner. The empty state never shows either. Please confirm which read command populates policyVendors_, and fall back to the empty state if it can be missing.

@ShridharGoel plz look into this issue

@Beamanator

Copy link
Copy Markdown
Contributor

pujan0707+99790@gmail.com

added

@ShridharGoel

Copy link
Copy Markdown
Contributor Author
  1. The page can show a spinner forever. WorkspaceVendorsPage.tsx:207 shows a loader while policyVendors === undefined. Nothing in App fetches this key. If the backend never writes it, for example when there are no vendors, the page never leaves the spinner. The empty state never shows either. Please confirm which read command populates policyVendors_, and fall back to the empty state if it can be missing.

@ShridharGoel plz look into this issue

I don't think it's an issue, because the "Vendors" tab itself shouldn't show when there's no vendor I think. I could not repro this, but let me know if you find some steps to repro it.

@mountiny

mountiny commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Onyx connectWithoutView usage was removed ✅

@Beamanator

Copy link
Copy Markdown
Contributor

@Pujan92 can you please do a final review per the latest changes and my requested changes here? 🙏

@Pujan92

Pujan92 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Conflicts @ShridharGoel

@ShridharGoel

Copy link
Copy Markdown
Contributor Author

@Pujan92 Fixed

@Pujan92

Pujan92 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

When an expense has set one vendor, and after that if that vendor is disabled, it shows in the list with Disabled text. is this intended?

Screen.Recording.2026-10-06.at.09.26.50.mov

@Beamanator

Beamanator commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

More conflicts 🤣 - cc @ShridharGoel

But ya from the linked issue, we said:

New-expense picker search excludes disabled vendors.

Which I think make sense and applies to "editing existing expenses" as well - we'll still want to show these disabled vendors in the Workspace -> Vendors list of all vendors, but not as a selectable vendor in the expense

Aah but in the video you shared @Pujan92 only the currently selected vendor (which is now disabled) is shown in the list, which i think is fine - once you select a different vendor, that disabled vendor stops showing in the list which sounds expected to me 👍

…e-disable

# Conflicts:
#	src/libs/PolicyUtils/index.ts
#	tests/unit/PolicyUtilsTest.ts
@ShridharGoel

Copy link
Copy Markdown
Contributor Author

Fixed conflicts

@Beamanator
Beamanator merged commit 22559f3 into Expensify:main Oct 8, 2026
35 of 36 checks passed
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🚧 Beamanator has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

OSBotify commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify OSBotify mentioned this pull request Oct 8, 2026
90 tasks done
@OSBotify

OSBotify commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/Beamanator in version: 9.5.6-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

A help site update is needed. I opened Docs updates for E/A#102756 Explain how to enable or disable imported vendors.

This PR lets admins turn vendors on or off with the Enabled toggle on the Vendors page. No beta is needed for Campfire, DualEntry, and Rillet. Their vendor matching articles said:

Vendors are managed in DualEntry, so the list is read-only in Expensify and refreshes when the connection syncs.

The docs PR replaces "read-only" in each article with one sentence on turning off a vendor's Enabled toggle. The QuickBooks Online, Sage Intacct, and Xero articles don't describe the Vendors page, so they need no change.

@ShridharGoel, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review

@applause-bot applause-bot Bot mentioned this pull request Oct 8, 2026
2 of 7 tasks
@nlemma

nlemma commented Oct 8, 2026

Copy link
Copy Markdown

Deploy Blocker #103529 was identified to be related to this PR.

@unzig21

unzig21 commented Oct 9, 2026

Copy link
Copy Markdown

Deploy Blocker #103556 was identified to be related to this PR.

@OSBotify

OSBotify commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/puneetlath in version: 9.5.6-6 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

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.

8 participants