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
[Due for payment 2026-10-28] [$175] [Exploratory] Spend Rules - Clicking Edit spend rule leads to Rules > General page #101699
Because Rules is Control-only, useControlOnlyRuleUpgradeRedirect immediately replaces the form with the upgrade page, and with no backTo given it substitutes the workspace Rules route (useControlOnlyRuleUpgradeRedirect.ts:33). After upgrading, the upgrade page honours that backTo faithfully (WorkspaceUpgradePage.tsx:186-188) — so the user lands on Rules, which resolves to the General tab. The upgrade page is not the bug; the missing destination upstream is.
What changes do you think we should make in order to solve the problem?
Pass upgradeBackTo from the two workspace spend-rule pages, mirroring the Wallet page:
In EditSpendRulePage, set it to ROUTES.RULES_SPEND_EDIT.getRoute(policyID, ruleID).
In AddSpendRulePage, set it to ROUTES.RULES_SPEND_NEW.getRoute(policyID).
After the upgrade, the user returns to the spend-rule form they asked for. Re-entering is safe: the policy is Control by then, so the hook's isCollectPolicy check is false and it will not redirect again.
Supporting detail
The landing tab is General because the fallback route carries no ?tab=, and PolicyRulesPageRevamp forces Collect users onto the General tab (PolicyRulesPageRevamp.tsx:91-109).
Alternative considered: change the hook's default backTo to include the Card restrictions tab. That hides the symptom for every caller but still never returns the user to the form, so it is worse.
No test covers this: tests/ui/SpendRuleCardPageTest.tsx mocks the redirect hook out entirely.
Not verified on a live build — the repro needs a Collect workspace with an issued Expensify Card. Confidence comes from the code path, which explains every reported symptom.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/101699) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Activity
applause-bot commentedon Sep 21, 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/7e0da7afac1647ccaca1c1167992cd4350b13ba514b77ed8d17659c098529848
MelvinBot commentedon Sep 21, 2026
Proposal
What is the root cause of that problem?
The workspace spend-rule pages never tell the upgrade page where to come back to, so it falls back to the workspace Rules page.
On a Collect workspace, "Edit spend rules" on the card details page navigates to the spend-rule screen (
DynamicWorkspaceExpensifyCardDetailsPage.tsx:248-258). That screen rendersSpendRulePageBasewithout the optionalupgradeBackToprop (EditSpendRulePage.tsx:12-19,AddSpendRulePage.tsx:12-19).Because Rules is Control-only,
useControlOnlyRuleUpgradeRedirectimmediately replaces the form with the upgrade page, and with nobackTogiven it substitutes the workspace Rules route (useControlOnlyRuleUpgradeRedirect.ts:33). After upgrading, the upgrade page honours thatbackTofaithfully (WorkspaceUpgradePage.tsx:186-188) — so the user lands on Rules, which resolves to the General tab. The upgrade page is not the bug; the missing destination upstream is.The same screen reached from Wallet works correctly because it does pass the prop (
WalletExpensifyCardSpendRulesPage.tsx:24).What changes do you think we should make in order to solve the problem?
Pass
upgradeBackTofrom the two workspace spend-rule pages, mirroring the Wallet page:EditSpendRulePage, set it toROUTES.RULES_SPEND_EDIT.getRoute(policyID, ruleID).AddSpendRulePage, set it toROUTES.RULES_SPEND_NEW.getRoute(policyID).After the upgrade, the user returns to the spend-rule form they asked for. Re-entering is safe: the policy is Control by then, so the hook's
isCollectPolicycheck is false and it will not redirect again.Supporting detail
?tab=, andPolicyRulesPageRevampforces Collect users onto the General tab (PolicyRulesPageRevamp.tsx:91-109).backToto include the Card restrictions tab. That hides the symptom for every caller but still never returns the user to the form, so it is worse.SpendRuleCardPage.tsx:110andSpendRuleCategoryPage.tsx:26also call the hook with nobackTo. Worth deciding whether they belong in the same PR.tests/ui/SpendRuleCardPageTest.tsxmocks the redirect hook out entirely.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/101699)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
melvin-bot commentedon Sep 24, 2026
@situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
melvin-bot commentedon Sep 28, 2026
@situchan Still overdue 6 days?! Let's take care of this!
melvin-bot commentedon Sep 30, 2026
@situchan 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
melvin-bot commentedon Oct 2, 2026
@situchan 10 days overdue. Is anyone even seeing these? Hello?
melvin-bot commentedon Oct 3, 2026
@situchan 10 days overdue. I'm getting more depressed than Marvin.
situchan commentedon Oct 7, 2026
@MelvinBot implement this for testing
23 remaining items
melvin-bot commentedon Oct 27, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Oct 27, 2026
Payment Summary
Resolving PRs:
Return to the spend rule form after upgrading from a workspace spend rule page #103365
Reviewer: @situchan owed $175 via NewDot
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Oct 30, 2026
Payment Summary
Contributor+: @situchan due $175 via NewDot