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-03-02] Rules - Category row shown in Merchant Rule after offline category deletion #82936
Version Number: V9.3.22-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:#82438 Email or phone of affected tester (no customers):dreamnitethedragon@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Redminote 10S Android 13 App Component: Money Requests
Action Performed:
Launch app
Create a workspace
Enable rules
Open expense rule - new rule - category
Note categories are listed
Open rules - add merchant rule - category
Note categories are listed
Open workspace chat
Start creating expense and open category row in the flow
Note categories are listed
Go offline
Go to category - settings
Toggle off members must categorise expense
Delete all categories
Go merchant rule/ expense rule / expense creation flow and note category row
Expected Result:
In expense rule and in expense creation flow, category row is not shown similarity in merchant rule also, category row must not be shown after deleting categories in offline.
Actual Result:
In expense rule and in expense creation flow, category row is not shown but in merchant rule category row is shown after deleting categories in offline.
👋 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.
Classification: Frontend bug Causing PR: #82438 - "Enable merchant rules v2" by @luacmartins (High confidence) Related Issues: #80855
Recommendation: REVERT
This PR enabled merchant rules for all users by removing the production environment check. However, the merchant rules feature has a bug where it does not properly handle offline category deletions. The category row continues to be shown in the merchant rule flow even after categories are deleted offline, while the expense rule and expense creation flows correctly hide the category row.
Labels: No changes needed - DeployBlockerCash is correctly applied as this is a frontend bug requiring an App fix.
Detailed Analysis
Evidence
The issue was reported in version V9.3.22-2 and is reproducible only in staging (not production) because merchant rules v2 is a new feature that does not exist in production yet. The bug was caught during regression testing of PR #82438.
The PR removed the production environment check that was previously hiding merchant rules:
/home/runner/_work/App/App/src/pages/workspace/rules/MerchantRules/MerchantRulePageBase.tsx - Contains the hasCategories() function that checks if categories should be shown
/home/runner/_work/App/App/src/pages/workspace/rules/MerchantRulesSection.tsx - The component that was modified in PR Enable merchant rules v2 #82438
Root Cause
The hasCategories() function in MerchantRulePageBase.tsx (lines 135-140) does not filter out categories with pendingAction: "delete":
This differs from other parts of the codebase that properly handle pending delete actions:
The hasEnabledOptions() utility function in OptionsListUtils correctly filters: option.enabled && option.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE
The IOURequestStepCategory component uses hasEnabledOptions(Object.values(policyCategories ?? {})) to determine if categories should be shown
The getAvailableNonPersonalPolicyCategories() function in CategoryUtils.ts filters out categories with pending delete actions
When offline:
User deletes all categories (they get pendingAction: "delete")
Expense rules and expense creation flows use hasEnabledOptions() which filters deleted categories, so category row is correctly hidden
Merchant rules use hasCategories() which only checks Object.keys().length, so category row incorrectly remains shown
While this bug existed before PR #82438, the PR made it visible to all users by removing the production gate.
Please re-state the problem that we are trying to solve in this issue.
When all workspace categories are deleted while offline, the Category row continues to appear in the Merchant Rule page even though those categories are pending deletion. This inconsistency differs from the expense creation flow and expense rule pages, which correctly hide the category row in the same scenario.
What is the root cause of that problem?
The hasCategories() function in MerchantRulePageBase uses Object.keys(policyCategories ?? {}).length > 0 to determine whether categories exist. This check does not account for the offline-first optimistic update pattern used by deleteWorkspaceCategories().
When categories are deleted offline, the optimistic update in Category sets each deleted category's pendingAction to CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE rather than immediately removing the keys from the Onyx store. The keys are only nullified upon server confirmation. As a result, Object.keys(policyCategories ?? {}).length > 0 remains true even when all categories are pending deletion, causing hasCategories() to incorrectly return true.
By contrast, the expense creation flow (MoneyRequestConfirmationList) and expense rule page (IOURequestStepCategory) both use hasEnabledOptions() from OptionsListUtils, which explicitly filters out categories with pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE. This is why those flows behave correctly while the merchant rule page does not.
What changes do you think we should make in order to solve the problem?
In MerchantRulePageBase, replace the naive key-count check with hasEnabledOptions() from OptionsListUtils:
// Before (line 139)returnObject.keys(policyCategories??{}).length>0;// AfterreturnhasEnabledOptions(policyCategories??{});
This mirrors the exact pattern used in the expense creation flow and expense rule page, ensuring that categories pending deletion are excluded from the check.
What alternative solutions did you explore? (Optional)
An inline filter could be added directly in hasCategories() without importing hasEnabledOptions, e.g. Object.values(policyCategories ?? {}).some(c => c.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE). However, reusing the existing hasEnabledOptions utility is preferable for consistency and maintainability, since it also checks the enabled flag and is already the established pattern for this exact scenario across the codebase.
changed the title [-]Rules - Category row shown in Merchant Rule after offline category deletion[/-][+][Due for payment 2026-03-02] Rules - Category row shown in Merchant Rule after offline category deletion[/+]on Feb 23, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.24-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@luacmartins@lydiabarclay The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
Activity
melvin-bot commentedon Feb 19, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #82438
melvin-bot commentedon Feb 19, 2026
💬 A slack conversation has been started in #expensify-open-source
melvin-bot commentedon Feb 19, 2026
Triggered auto assignment to @lydiabarclay (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.github-actions commentedon Feb 19, 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:
OSBotify commentedon Feb 19, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: #82438 - "Enable merchant rules v2" by @luacmartins (High confidence)
Related Issues: #80855
Recommendation: REVERT
This PR enabled merchant rules for all users by removing the production environment check. However, the merchant rules feature has a bug where it does not properly handle offline category deletions. The category row continues to be shown in the merchant rule flow even after categories are deleted offline, while the expense rule and expense creation flows correctly hide the category row.
Labels: No changes needed -
DeployBlockerCashis correctly applied as this is a frontend bug requiring an App fix.Detailed Analysis
Evidence
The issue was reported in version V9.3.22-2 and is reproducible only in staging (not production) because merchant rules v2 is a new feature that does not exist in production yet. The bug was caught during regression testing of PR #82438.
The PR removed the production environment check that was previously hiding merchant rules:
Verification
The affected files are:
/home/runner/_work/App/App/src/pages/workspace/rules/MerchantRules/MerchantRulePageBase.tsx- Contains thehasCategories()function that checks if categories should be shown/home/runner/_work/App/App/src/pages/workspace/rules/MerchantRulesSection.tsx- The component that was modified in PR Enable merchant rules v2 #82438Root Cause
The
hasCategories()function inMerchantRulePageBase.tsx(lines 135-140) does not filter out categories withpendingAction: "delete":This differs from other parts of the codebase that properly handle pending delete actions:
hasEnabledOptions()utility function inOptionsListUtilscorrectly filters:option.enabled && option.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETEIOURequestStepCategorycomponent useshasEnabledOptions(Object.values(policyCategories ?? {}))to determine if categories should be showngetAvailableNonPersonalPolicyCategories()function inCategoryUtils.tsfilters out categories with pending delete actionsWhen offline:
pendingAction: "delete")hasEnabledOptions()which filters deleted categories, so category row is correctly hiddenhasCategories()which only checksObject.keys().length, so category row incorrectly remains shownWhile this bug existed before PR #82438, the PR made it visible to all users by removing the production gate.
twilight2294 commentedon Feb 19, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When all workspace categories are deleted while offline, the Category row continues to appear in the Merchant Rule page even though those categories are pending deletion. This inconsistency differs from the expense creation flow and expense rule pages, which correctly hide the category row in the same scenario.
What is the root cause of that problem?
The
hasCategories()function in MerchantRulePageBase usesObject.keys(policyCategories ?? {}).length > 0to determine whether categories exist. This check does not account for the offline-first optimistic update pattern used bydeleteWorkspaceCategories().When categories are deleted offline, the optimistic update in Category sets each deleted category's
pendingActiontoCONST.RED_BRICK_ROAD_PENDING_ACTION.DELETErather than immediately removing the keys from the Onyx store. The keys are only nullified upon server confirmation. As a result,Object.keys(policyCategories ?? {}).length > 0remainstrueeven when all categories are pending deletion, causinghasCategories()to incorrectly returntrue.By contrast, the expense creation flow (
MoneyRequestConfirmationList) and expense rule page (IOURequestStepCategory) both usehasEnabledOptions()from OptionsListUtils, which explicitly filters out categories withpendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE. This is why those flows behave correctly while the merchant rule page does not.What changes do you think we should make in order to solve the problem?
In MerchantRulePageBase, replace the naive key-count check with
hasEnabledOptions()fromOptionsListUtils:This mirrors the exact pattern used in the expense creation flow and expense rule page, ensuring that categories pending deletion are excluded from the check.
What alternative solutions did you explore? (Optional)
An inline filter could be added directly in
hasCategories()without importinghasEnabledOptions, e.g.Object.values(policyCategories ?? {}).some(c => c.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE). However, reusing the existinghasEnabledOptionsutility is preferable for consistency and maintainability, since it also checks theenabledflag and is already the established pattern for this exact scenario across the codebase.8 remaining items
luacmartins commentedon Feb 19, 2026
I have a PR in review to fix this issue. Let's keep it open for now
[-]Rules - Category row shown in Merchant Rule after offline category deletion[/-][+][Due for payment 2026-03-02] Rules - Category row shown in Merchant Rule after offline category deletion[/+]melvin-bot commentedon Feb 23, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Feb 23, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.24-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-03-02. 🎊
melvin-bot commentedon Feb 23, 2026
@luacmartins @lydiabarclay The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
lydiabarclay commentedon Mar 2, 2026
@luacmartins is payment needed on this GH?
luacmartins commentedon Mar 2, 2026
No, good to close.