You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expensify Card - Spend rule changes are saved without confirming the changes #92707
Version Number: 9.3.99-2 Reproducible in staging?: Yes Reproducible in production?: N/A - new feature, doesn't exist in prod If this was caught during regression testing, add the test name, ID and link from BrowserStack:#92009 Email or phone of affected tester (no customers):applausetester+ssndjois2jd1@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.5 / Chrome App Component: Workspace Settings
Action Performed:
Precondition:
Log in with Expensifail account.
Set up workspace with bank account and enable Expensify Card feature.
Enable Rules.
Go to staging.new.expensify.com
Go to workspace settings > Expensify Card.
Click Issue card.
Select user.
Select Virtual card.
Select limit type and enter amount > Next.
Enable Spend rule, then enter any rule details.
Enable Expiration date, then add dates.
Proceed to confirm page.
On confirm page, click Expiration date.
Disable both spend rule and expiration date.
Click RHP back button.
Click Expiration date again.
Expected Result:
Spend rule will be enabled because user clicks back button instead of Confirm button.
Actual Result:
Spend rule is disabled when user clicks back button instead of Confirm button (spend rule changes are saved without confirming it), which is inconsistent with expiration date because expiration date is enabled.
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Summary: The "Add spend rule" toggle commits to Onyx immediately on toggle, while the "Add expiration date" toggle only commits when you press Confirm. So when you edit from the confirmation page and press the back button (which discards), the spend-rule change is already persisted but the expiration change is not — producing the inconsistent state in the report.
What is the root cause of that problem?
The two toggles on the Set card rules step use different persistence models:
Spend rule toggle writes to Onyx on every toggle. onToggle → handleToggleSpendRules → setIssueNewCardData(policyID, {spendRuleEnabled}), which is a direct Onyx.merge. The change is saved the instant you flip it.
When editing from the confirm page, the header back button runs handleBackButtonPress, which navigates back to CONFIRMATIONwithout passing any data — so it neither saves the local expiration state nor reverts the already-saved spendRuleEnabled. Net result of the repro: spendRuleEnabled=false is already persisted (spend rule disappears), while validFrom/validThru are untouched (expiration date stays) — the exact inconsistency reported.
Why spend rule was built to persist immediately
The spend rule section navigates to sub-pages (Choose rule, Merchant, Category, Max amount) that read/write the issue-card data, so its state must survive that navigation via Onyx. The expiration date is fully inline, so local state is sufficient for it. That architectural difference is what created the mismatch.
What changes do you think we should make in order to solve the problem?
Make the spend-rule edit respect the same "back = discard, Confirm = save" gate the expiration date already follows.
When the step is entered in edit mode (isEditing), snapshot the spend-rule fields once (spendRuleEnabled, spendRuleOption, spendRuleID, spendRuleValue). In handleBackButtonPress, when isEditing, restore that snapshot via setIssueNewCardStepAndData (passing the snapshot back as data) instead of returning to CONFIRMATION with no data. That way pressing back discards spend-rule changes, matching the expiration date toggle, and Confirm continues to save as it does today.
What alternative solutions did you explore? (Optional)
Make expiration date persist immediately too (mirror the spend rule): this would make both consistent but in the opposite direction — back would then save both, which contradicts the reporter's expected behavior that back should discard.
Possibly related (same area, different bug)
Expensify/App#92391 — "Restriction field opens blank Set card rule page when rules are disabled." Same issuing-flow area; not a duplicate.
Next Steps for Contributor+ team: To accept:@MelvinBot implement this to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
I dont think this is a bug, it feels like the other fields are a bug instead. If the user enters data and goes back, the entered data should still be visible. Going to close this one
Activity
applause-bot commentedon Jun 4, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/a0f326faad19e577a540755c8bf3206622c16ed76274197cb3e92418d8025c92
melvin-bot commentedon Jun 4, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #92009
melvin-bot commentedon Jun 4, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Jun 4, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
MelvinBot commentedon Jun 4, 2026
Proposal
Summary: The "Add spend rule" toggle commits to Onyx immediately on toggle, while the "Add expiration date" toggle only commits when you press Confirm. So when you edit from the confirmation page and press the back button (which discards), the spend-rule change is already persisted but the expiration change is not — producing the inconsistent state in the report.
What is the root cause of that problem?
The two toggles on the Set card rules step use different persistence models:
onToggle→handleToggleSpendRules→setIssueNewCardData(policyID, {spendRuleEnabled}), which is a directOnyx.merge. The change is saved the instant you flip it.expirationToggled/onToggle={setExpirationToggled}.validFrom/validThruare only written to Onyx insidesubmit, i.e. only when Confirm is pressed.When editing from the confirm page, the header back button runs
handleBackButtonPress, which navigates back toCONFIRMATIONwithout passing anydata— so it neither saves the local expiration state nor reverts the already-savedspendRuleEnabled. Net result of the repro:spendRuleEnabled=falseis already persisted (spend rule disappears), whilevalidFrom/validThruare untouched (expiration date stays) — the exact inconsistency reported.Why spend rule was built to persist immediately
The spend rule section navigates to sub-pages (Choose rule, Merchant, Category, Max amount) that read/write the issue-card data, so its state must survive that navigation via Onyx. The expiration date is fully inline, so local state is sufficient for it. That architectural difference is what created the mismatch.
What changes do you think we should make in order to solve the problem?
Make the spend-rule edit respect the same "back = discard, Confirm = save" gate the expiration date already follows.
When the step is entered in edit mode (
isEditing), snapshot the spend-rule fields once (spendRuleEnabled,spendRuleOption,spendRuleID,spendRuleValue). InhandleBackButtonPress, whenisEditing, restore that snapshot viasetIssueNewCardStepAndData(passing the snapshot back asdata) instead of returning toCONFIRMATIONwith no data. That way pressing back discards spend-rule changes, matching the expiration date toggle, and Confirm continues to save as it does today.What alternative solutions did you explore? (Optional)
Possibly related (same area, different bug)
Expensify/App#92391 — "Restriction field opens blank Set card rule page when rules are disabled." Same issuing-flow area; not a duplicate.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement thisto create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
JS00001 commentedon Jun 4, 2026
Behind a beta
JS00001 commentedon Jun 8, 2026
Will work on a fix for this
JS00001 commentedon Jun 8, 2026
I dont think this is a bug, it feels like the other fields are a bug instead. If the user enters data and goes back, the entered data should still be visible. Going to close this one