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 2025-05-27] [$250] Categories - RHP header title does not change after updating category name offline #58351
Version Number: 9.1.12-5 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A If this was caught during regression testing, add the test name, ID and link from TestRail: Exp Email or phone of affected tester (no customers):applausetester+130302kh@applause.expensifail.com Issue reported by: Applause Internal Team Device used: Mac 15.3 / Chrome App Component: Workspace Settings
Action Performed:
Go to staging.new.expensify.com
Go to workspace settings > Categories.
Go offline.
Click any category.
Click Name.
Edit the name and save it.
Expected Result:
The RHP header title will update.
Actual Result:
The RHP header title does not update.
It only updates after closing and reopening the RHP.
🚨 Edited by proposal-police: This proposal was edited at 2025-03-13 09:37:48 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Categories - RHP header title does not change after updating category name offline
What is the root cause of that problem?
The header title was dependent on the route parameter categoryName, which wasn't updated immediately when the category name changed offline due to delays in propagating route parameter updates
What changes do you think we should make in order to solve the problem?
Instead of using the route parameter, directly use the category name from the policy data (policyCategory.name), which is updated optimistically via Onyx even when offline
changed the title [-]Categories - RHP header title does not change after updating category name offline[/-][+][$250] Categories - RHP header title does not change after updating category name offline[/+]on Mar 13, 2025
So navigating back using old category name is not the real RCA that caused the issue.
When opening the Category edit page, the Category settings page is not removed from the screen, it's just hidden behind the edit page. This behavior makes the above useEffect logic still active.
When we edit the category name, changes in dependency triggers the effect, changing the params. However, user are still in the Category edit page, so the navigation.setParams only change the param for the Edit page, and not the Category page. All of this happens before user even navigate back.
But why we still see the URL is updated when navigating back when online?
Because we use policyCategory as dependency. When updating category name, we set pendingFields value:
The latter update triggers the effect again, making navigation.setParams run once more after navigate back to Category page. So we get the little delay and then have the correct URL and title.
When offline, successData is not merged, so navigating back to Category page doesn't trigger another setParams.
What changes do you think we should make in order to solve the problem?
Only change the title doesn't solve the whole problem because the URL is not changed.
Navigating back using the updated category name is risky and not future proof, because BE might not accept the change and reset the old value. In this case user will get a Not found page.
Instead, we should trigger the setParams effect on page focus
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
We can create a test to simulate the edit category name flow and make sure that the title and url is correctly set.
What alternative solutions did you explore? (Optional)
NA
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
1a. Result of the original design (eg. a case wasn't considered)
1b. Mistake during implementation
1c. Backend bug
1z. Other:
Where bug was reported:
2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
2b. Reported on staging (eg. found during regression or PR testing)
2d. Reported on a PR
2z. Other:
Who reported the bug:
3a. Expensify user
3b. Expensify employee
3c. Contributor
3d. QA
3z. Other:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: Seems like we didn't consider offline behavior on implementation of the page.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/a
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Activity
melvin-bot commentedon Mar 13, 2025
Triggered auto assignment to @laurenreidexpensify (
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.ryntgh commentedon Mar 13, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-03-13 09:37:48 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Categories - RHP header title does not change after updating category name offline
What is the root cause of that problem?
The header title was dependent on the route parameter
categoryName, which wasn't updated immediately when the category name changed offline due to delays in propagating route parameter updatesApp/src/pages/workspace/categories/CategorySettingsPage.tsx
Lines 148 to 151 in 2496dfa
What changes do you think we should make in order to solve the problem?
Instead of using the route parameter, directly use the category name from the policy data (
policyCategory.name), which is updated optimistically via Onyx even when offlineWhat specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
We could create a test to ensure that the header updates immediately after the category name is changed, if needed
What alternative solutions did you explore? (Optional)
New-Expensify.mp4
[-]Categories - RHP header title does not change after updating category name offline[/-][+][$250] Categories - RHP header title does not change after updating category name offline[/+]melvin-bot commentedon Mar 13, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021900183016820569237
melvin-bot commentedon Mar 13, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @getusha (
External)daledah commentedon Mar 13, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
The RHP header title does not update.
It only updates after closing and reopening the RHP.
What is the root cause of that problem?
We already have a logic to change the params and title when category are edited here:
App/src/pages/workspace/categories/CategorySettingsPage.tsx
Lines 65 to 70 in e0a699f
So navigating back using old category name is not the real RCA that caused the issue.
When opening the Category edit page, the Category settings page is not removed from the screen, it's just hidden behind the edit page. This behavior makes the above
useEffectlogic still active.When we edit the category name, changes in dependency triggers the effect, changing the params. However, user are still in the Category edit page, so the
navigation.setParamsonly change the param for the Edit page, and not the Category page. All of this happens before user even navigate back.But why we still see the URL is updated when navigating back when online?
Because we use
policyCategoryas dependency. When updating category name, we setpendingFieldsvalue:App/src/libs/actions/Policy/Category.ts
Lines 675 to 678 in e0a699f
And when API call sucessfully, we remove them:
App/src/libs/actions/Policy/Category.ts
Lines 709 to 711 in e0a699f
The latter update triggers the effect again, making
navigation.setParamsrun once more after navigate back to Category page. So we get the little delay and then have the correct URL and title.When offline,
successDatais not merged, so navigating back to Category page doesn't trigger anothersetParams.What changes do you think we should make in order to solve the problem?
Only change the title doesn't solve the whole problem because the URL is not changed.
Navigating back using the updated category name is risky and not future proof, because BE might not accept the change and reset the old value. In this case user will get a Not found page.
Instead, we should trigger the
setParamseffect on page focusApp/src/pages/workspace/categories/CategorySettingsPage.tsx
Lines 65 to 70 in e0a699f
Optionally, set dependency only on
policyCategory?.nameto prevent unwanted effect triggerWhat specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
We can create a test to simulate the edit category name flow and make sure that the title and url is correctly set.
What alternative solutions did you explore? (Optional)
NA
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
melvin-bot commentedon Mar 17, 2025
@getusha Whoops! This issue is 2 days overdue. Let's get this updated quick!
84 remaining items
laurenreidexpensify commentedon May 29, 2025
@getusha bump thanks
getusha commentedon May 29, 2025
Will complete the checklist until EOD tomorrow.
melvin-bot commentedon May 30, 2025
Triggered auto assignment to @adelekennedy (
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.laurenreidexpensify commentedon May 30, 2025
👋 @adelekennedy I am OOO til 9 June, can you please issue payments once checklist is complete + add anything to testrail. Thank you!
getusha commentedon Jun 2, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: Seems like we didn't consider offline behavior on implementation of the page.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/a
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
adelekennedy commentedon Jun 2, 2025
Payment Summary
Contributor: @daledah paid $250 via Upwork
Contributor+: @getusha due $250 via NewDot
garrettmknight commentedon Jun 26, 2025
$250 approved for @getusha