Repository navigation
[No QA] update previousTaxCode in setPolicyTaxCode successData #94286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -589,6 +589,7 @@ function setPolicyTaxCode( | |
| pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE, | ||
| errorFields: {code: null}, | ||
| previousTaxCode: oldTaxCode, | ||
| optimisticPreviousTaxCode: oldTaxCode, | ||
| }, | ||
| }, | ||
| }, | ||
|
|
@@ -612,6 +613,8 @@ function setPolicyTaxCode( | |
| pendingFields: {...originalTaxRate.pendingFields, code: null}, | ||
| pendingAction: null, | ||
| errorFields: {code: null}, | ||
| previousTaxCode: oldTaxCode, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dukenv0307 I think we should update the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dmkt9 Do you mean update it optimistically or in BE?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I mean we should update both.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you give me the test steps to reproduce the bug (if we don't update snapshot)? I'll update it in the follow-up PR
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. You can use my PR (#94007) for testing. Please refer to Test 4:
Expected Result:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MelvinBot can you please create the new issue in E/E repo?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dmkt9 I can't reproduce, can you please check again? previousTaxCode is already in snapshots Screen.Recording.2026-06-30.at.4.25.05.PM.mov
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ah, thanks! It works well for me. |
||
| optimisticPreviousTaxCode: null, | ||
| }, | ||
| }, | ||
| }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping
previousTaxCodein the confirmed Onyx state makes the old code a permanent alias for this rate. If the user later reuses that old code for another tax,validateTaxCode/isExistingTaxCodeonly reject existing object keys, and the old key was removed; thenWorkspaceEditTaxPagecallsgetCurrentTaxID(), which can return this renamed rate viapreviousTaxCodebefore it reaches the real reused-code key. In that scenario the edit route for the newly reused code redirects to this renamed tax, so the new tax cannot be edited or deleted correctly.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I introduced
optimisticPreviousTaxCodeto fix this issue cc @truph01