Skip to content

Allow clearing the Default Vendor by re-selecting it#96227

Open
Beamanator wants to merge 2 commits into
mainfrom
beaman-clear-default-vendor
Open

Allow clearing the Default Vendor by re-selecting it#96227
Beamanator wants to merge 2 commits into
mainfrom
beaman-clear-default-vendor

Conversation

@Beamanator

Copy link
Copy Markdown
Contributor

Explanation of Change

Once a Default Vendor was set on any accounting integration's export config, there was no way to unselect it — tapping the currently-selected row was a silent no-op that just navigated back. This blocked vendor-matching CC beta testers who needed to reset workspaces between test scenarios (and it's been latent for every workspace that has ever set a Default Vendor).

This change drops the if (row.value !== currentVendor) guard on all five Default Vendor selector pages. Re-tapping the currently-selected row now sends a clear value to the backend and navigates back:

  • QBO (shared bill + credit-card page) and QBD send CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE, matching the sentinel these fields already accept via bulk config paths.
  • Sage Intacct, Certinia, and NetSuite send '' (empty string) — those fields hold raw vendor IDs with no NONE sentinel.

Note: the dedicated UPDATE_*_DEFAULT_VENDOR single-field backend commands need to accept the clear value. QBD/QBO-bill have partial precedent (via bulk config paths); the QBO credit-card, Sage, Certinia, and NetSuite single-field commands don't have prior clear-value calls to confirm against. This should be verified on the backend before merging.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/659748
PROPOSAL: https://github.com/Expensify/Expensify/issues/659748#issuecomment-4985966633

Tests

  1. Open a workspace with any accounting integration connected (QBO, Sage Intacct, Certinia, NetSuite, or QBD).
  2. Configure the integration's non-reimbursable export destination to something that uses a Default Vendor (e.g. QBO Non-reimbursable → Vendor Bill or Credit Card).
  3. Navigate to the Default Vendor row and select any vendor.
  4. Return to the Default Vendor row and tap the currently-selected vendor.
  5. Verify the vendor is now cleared (the row shows no selected vendor, and re-opening the selector shows no row highlighted).
  6. Repeat for each of the 5 affected integrations: QBO (bill + credit card), QBD, Sage Intacct (reimbursable + non-reimbursable), Certinia, NetSuite.
  • Verify that no errors appear in the JS console

Offline tests

  1. Set a Default Vendor while online.
  2. Turn off network connection.
  3. Tap the currently-selected vendor.
  4. Verify the row updates optimistically to a cleared state.
  5. Turn network back on and verify the change persists.

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.
  • 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
  • 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
  • If new assets were added or existing ones were modified
  • If the PR modifies code that runs when editing or sending messages
  • If the PR modifies a generic component
  • If the PR modifies a component related to any of the existing Storybook stories
  • If the PR modifies a component or page that can be accessed by a direct deeplink
  • If the PR modifies the UI or modifies the form input styles
  • 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

Tapping the currently-selected vendor on any accounting integration's
Default Vendor selector now clears it. Previously the guarded update
call skipped this case, leaving no path to unset the field from the UI.

QBO and QBD send CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE; Sage Intacct,
Certinia, and NetSuite send an empty string.

Fixes Expensify/Expensify#659748
@Beamanator Beamanator requested review from a team as code owners July 15, 2026 22:51
@melvin-bot melvin-bot Bot requested a review from Eskalifer1 July 15, 2026 22:51
@melvin-bot

melvin-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

@Eskalifer1 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 trjExpensify and removed request for a team July 15, 2026 22:51
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Coverage Δ
...sDesktopNonReimbursableDefaultVendorSelectPage.tsx 0.00% <0.00%> (ø)
...port/QuickbooksNonReimbursableVendorSelectPage.tsx 0.00% <0.00%> (ø)
...cct/export/DynamicSageIntacctDefaultVendorPage.tsx 0.00% <0.00%> (ø)
.../DynamicNetSuiteExportExpensesVendorSelectPage.tsx 0.00% <0.00%> (ø)
...ting/certinia/export/CertiniaDefaultVendorPage.tsx 0.00% <0.00%> (ø)
... and 8 files with indirect coverage changes

if (row.value !== exportConfig?.vendorAccount && policyID) {
updateFinancialForceDefaultVendor(policyID, row.value, exportConfig?.vendorAccount ?? null);
if (policyID) {
const newValue = row.value === exportConfig?.vendorAccount ? '' : row.value;

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-2 (docs)

The bare empty string '' is used as a magic sentinel to represent "no vendor / deselected". It is not self-explanatory and it is inconsistent with the sibling changes in this same PR (QBO and QBD) which use the named constant CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE for the identical "cleared vendor" concept.

Use a named/documented value instead of the bare literal, e.g.:

const newValue = row.value === exportConfig?.vendorAccount ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : row.value;

or, if the backend requires an empty string here, extract a clearly-named constant documenting that '' means "no default vendor".


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

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.

from Alex's Claude agent

Fair — the bare '' was inconsistent with the QBO/QBD sites. Extracted a local, self-documenting CLEAR_DEFAULT_VENDOR constant per file (with a comment noting the backend uses a raw vendor ID, not the NONE sentinel used by QBO/QBD). Using CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE would be semantically wrong for these backends per MelvinBot's plan review.

Fixed in 9c7dcfd.

if (value !== defaultVendor) {
updateSageIntacctDefaultVendor(policyID, settingName, value, defaultVendor);
}
const newValue = value === defaultVendor ? '' : value;

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-2 (docs)

The bare empty string '' is used as a magic sentinel to represent the "deselected / cleared" vendor. It is not self-explanatory and is inconsistent with the sibling changes in this PR (QBO and QBD) which use the named constant CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE for the same concept.

Replace the literal with a named/documented value, e.g.:

const newValue = value === defaultVendor ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : value;

or extract a clearly-named constant documenting that '' means "no default vendor" if the empty string is what the Sage Intacct backend expects.


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

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.

from Alex's Claude agent

Fair — the bare '' was inconsistent with the QBO/QBD sites. Extracted a local, self-documenting CLEAR_DEFAULT_VENDOR constant per file (with a comment noting the backend uses a raw vendor ID, not the NONE sentinel used by QBO/QBD). Using CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE would be semantically wrong for these backends per MelvinBot's plan review.

Fixed in 9c7dcfd.

if (config?.defaultVendor !== value && policyID) {
updateNetSuiteDefaultVendor(policyID, value, config?.defaultVendor);
if (policyID) {
const newValue = value === config?.defaultVendor ? '' : value;

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-2 (docs)

The bare empty string '' is used as a magic sentinel for the "deselected / cleared" vendor value. It is not self-explanatory and is inconsistent with the sibling changes in this PR (QBO and QBD) which use the named constant CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE for the identical "cleared vendor" concept.

Replace the literal with a named/documented value, e.g.:

const newValue = value === config?.defaultVendor ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : value;

or extract a clearly-named constant documenting that '' means "no default vendor" if the NetSuite backend requires the empty string.


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

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.

from Alex's Claude agent

Fair — the bare '' was inconsistent with the QBO/QBD sites. Extracted a local, self-documenting CLEAR_DEFAULT_VENDOR constant per file (with a comment noting the backend uses a raw vendor ID, not the NONE sentinel used by QBO/QBD). Using CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE would be semantically wrong for these backends per MelvinBot's plan review.

Fixed in 9c7dcfd.

@Beamanator

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: f037fc3d1b

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

@Beamanator Beamanator added the InternalQA This pull request required internal QA label Jul 15, 2026
@Beamanator

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 9c7dcfdcec

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

@Eskalifer1

Copy link
Copy Markdown
Contributor

Hi @Beamanator, let me know when this is ready for review, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

InternalQA This pull request required internal QA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants