Allow clearing the Default Vendor by re-selecting it#96227
Conversation
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
|
@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] |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
| if (row.value !== exportConfig?.vendorAccount && policyID) { | ||
| updateFinancialForceDefaultVendor(policyID, row.value, exportConfig?.vendorAccount ?? null); | ||
| if (policyID) { | ||
| const newValue = row.value === exportConfig?.vendorAccount ? '' : row.value; |
There was a problem hiding this comment.
❌ 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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
❌ 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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
❌ 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.
There was a problem hiding this comment.
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.
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ 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". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ 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". |
|
Hi @Beamanator, let me know when this is ready for review, thank you! |
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:CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE, matching the sentinel these fields already accept via bulk config paths.''(empty string) — those fields hold raw vendor IDs with noNONEsentinel.Note: the dedicated
UPDATE_*_DEFAULT_VENDORsingle-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
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionmainbranch 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