Open lanitochka17 opened 1 week ago
Triggered auto assignment to @JmillsExpensify (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.
"Default tax rate" briefly changes back to the default one when changing category name for the first time
In
We use categoryName
from url params to get tax rate name. However, after changing catefory name, categoryName
remains old value for a brief moment before it gets updated:
And policy?.rules?.expenseRules
would have data of new category name, which will make categoryName
doesn't exist in the rules, CategoryUtils.getCategoryDefaultTaxRate
returns default rate value.
We should use policyCategory?.name
, as this value also gets updated simultaneously when changing category name.
const taxID = CategoryUtils.getCategoryDefaultTaxRate(policy?.rules?.expenseRules ?? [], policyCategory?.name ?? categoryName, policy?.taxRates?.defaultExternalID);
NA
"Default tax rate" briefly changes back to the default one
The defaultTaxRateText
still receives the old categoryName
after returning from editing the category name
https://github.com/Expensify/App/blob/0c2900cb60e3e22ac5ca22e8485bb357de64db67/src/pages/workspace/categories/CategorySettingsPage.tsx#L84
And the categoryName
is taken from the URL parameters, and the URL doesn't update categoryName
right away. So, after navigating back, it still uses the old categoryName
, causing this issue.
https://github.com/Expensify/App/blob/0c2900cb60e3e22ac5ca22e8485bb357de64db67/src/pages/workspace/categories/CategorySettingsPage.tsx#L38
We should set the params for navigation before navigating back, something like this:
// .src/pages/workspace/categories/EditCategoryPage.tsx#L47
const editCategory = useCallback(
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.WORKSPACE_CATEGORY_FORM>) => {
....
+ Navigation.setParams({categoryName: newCategoryName});
Navigation.goBack();
},
[backTo, currentCategoryName, route.params.categoryName, route.params.policyID],
);
@JmillsExpensify Eep! 4 days overdue now. Issues have feelings too...
@JmillsExpensify 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
Job added to Upwork: https://www.upwork.com/jobs/~021844119049804579315
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External
)
Opened up for proposal review
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.43-1 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Issue reported by: Applause - Internal Team
Issue found when executing PR https://github.com/Expensify/App/pull/49867
Action Performed:
Expected Result:
"Default tax rate" should be the one I have set before
Actual Result:
"Default tax rate" briefly changes back to the default one when changing category name for the first time
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/a9a66180-ca10-4649-979b-4be72ce8754e
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @abdulrahuman5196