-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[$250] Android - Category - "Default tax rate" briefly changes back to the default one #50078
Comments
Triggered auto assignment to @JmillsExpensify ( |
ProposalPlease re-state the problem that we are trying to solve in this issue."Default tax rate" briefly changes back to the default one when changing category name for the first time What is the root cause of that problem?In App/src/pages/workspace/categories/CategorySettingsPage.tsx Lines 84 to 85 in 19a137d
We use App/src/pages/workspace/categories/CategorySettingsPage.tsx Lines 62 to 67 in 19a137d
And What changes do you think we should make in order to solve the problem?We should use
const taxID = CategoryUtils.getCategoryDefaultTaxRate(policy?.rules?.expenseRules ?? [], policyCategory?.name ?? categoryName, policy?.taxRates?.defaultExternalID); What alternative solutions did you explore? (Optional)NA |
Edited by proposal-police: This proposal was edited at 2024-10-16 16:07:27 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue."Default tax rate" briefly changes back to the default one What is the root cause of that problem?When we return to the category page from the edit category page, the function The reason
After that,
Because This video describes what I mentioned above.Screen.Recording.2024-10-24.at.19.03.25.mp4This issue happened only once after the first editing of the category name due to changes in the policy?.rules?.expenseRules data object structure. In React, useEffect or useMemo use shallow comparison: React only compares references of objects/arrays, not their contents. You can see in the JSON below that policy?.rules?.expenseRules changes after the first editing of the category name, and it will not change for the next edited category name because the policy?.rules?.expenseRules object structure does not change. Therefore, this issue will not happen with the next edited category name. and This is // Before editing the category name (from SetPolicyCategoryTax response)
[
{
"tax": { "field_id_TAX": { "externalID": "id_TAX_RATE_1" } },
"applyWhen": [
{ "condition": "matches", "field": "category", "value": "Taxes" }
]
}
]
// After editing the category name and going back to the category page(from RenameWorkspaceCategory response)
[
{
"applyWhen": [
{ "condition": "matches", "field": "category", "value": "Taxes" }
],
"id": "671a27db42e27",
"tax": { "field_id_TAX": { "externalID": "id_TAX_RATE_1" } }
}
] What changes do you think we should make in order to solve the problem?To resolve this issue, we must call defaultTaxRateText after the category name update is complete. To do that, we must delay going back until the category name has finished updating. Something like this: // .src/pages/workspace/categories/EditCategoryPage.tsx#L52
const editCategory = useCallback(
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.WORKSPACE_CATEGORY_FORM>) => {
....
+ InteractionManager.runAfterInteractions(() => {
+ requestAnimationFrame(() => {
Navigation.goBack(
isQuickSettingsFlow
? ROUTES.SETTINGS_CATEGORY_SETTINGS.getRoute(route.params.policyID, route.params.categoryName, backTo)
: ROUTES.WORKSPACE_CATEGORY_SETTINGS.getRoute(route.params.policyID, route.params.categoryName),
);
+ });
+ });
},
[backTo, currentCategoryName, route.params.categoryName, route.params.policyID],
); What alternative solutions did you explore? (Optional)alternative solutions 1Or we can use the policyCategory data to get the new category name after editing to retrieve the default tax rate, because policyCategory has updated values that match with expenseRules - const taxID = CategoryUtils.getCategoryDefaultTaxRate(policy?.rules?.expenseRules ?? [], categoryName, policy?.taxRates?.defaultExternalID);
+ const taxID = CategoryUtils.getCategoryDefaultTaxRate(
+ policy?.rules?.expenseRules ?? [],
+ !policyCategory?.name
+ ? categoryName
+ : (policyCategory?.name !== categoryName
+ ? policyCategory?.name
+ : categoryName)
+ policy?.taxRates?.defaultExternalID,
+ );
POC
Screen.Recording.2024-10-03.at.23.19.38.mov |
@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 ( |
Opened up for proposal review |
@JmillsExpensify, @abdulrahuman5196 Huh... This is 4 days overdue. Who can take care of this? |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@JmillsExpensify @abdulrahuman5196 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
Still waiting on proposal review. |
Checking now |
I don't see the issue anymore, can we check if its still reproducible? Screen.Recording.2024-10-17.at.6.54.31.PM.mov |
Still able to be reproduced
Screen.Recording.2024-10-17.at.20.40.44.mov |
@abdulrahuman5196 Can you create a new workspace and follow the steps in this ticket? This issue just happened once. |
Proposal updated
@abdulrahuman5196 I would like to share this video with you to show how we can reproduce this issue. Screen.Recording.2024-10-24.at.19.44.03.mov |
Thank you for this. Let me try again a couple of times today and update here. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Still in progress |
@JmillsExpensify @abdulrahuman5196 this issue is now 4 weeks old, please consider:
Thanks! |
ProposalPlease re-state the problem that we are trying to solve in this issue.Android: "Default tax rate" temporarily reverts to the default value. What is the root cause of that problem?There is a chance that we navigated before execute Onyx.update first. The blinking actually also affect the category name itself, not only rate. What changes do you think we should make in order to solve the problem?In this case, it's important to execute Modify this code: App/src/pages/workspace/categories/EditCategoryPage.tsx Lines 52 to 56 in d365d39
To Navigation.setNavigationActionToMicrotaskQueue(()=>{
Navigation.goBack(
isQuickSettingsFlow
? ROUTES.SETTINGS_CATEGORY_SETTINGS.getRoute(route.params.policyID, route.params.categoryName, backTo)
: ROUTES.WORKSPACE_CATEGORY_SETTINGS.getRoute(route.params.policyID, route.params.categoryName),
);
}); or only to this if category name changes const editCategory = useCallback(
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.WORKSPACE_CATEGORY_FORM>) => {
const newCategoryName = values.categoryName.trim();
const navigateBack = () => {
Navigation.goBack(
isQuickSettingsFlow
? ROUTES.SETTINGS_CATEGORY_SETTINGS.getRoute(route.params.policyID, route.params.categoryName, backTo)
: ROUTES.WORKSPACE_CATEGORY_SETTINGS.getRoute(route.params.policyID, route.params.categoryName),
);
};
// Do not call the API if the edited category name is the same as the current category name
if (currentCategoryName !== newCategoryName) {
Category.renamePolicyCategory(route.params.policyID, {oldName: currentCategoryName, newName: values.categoryName});
Navigation.setNavigationActionToMicrotaskQueue(navigateBack);
return;
}
navigateBack();
},
[isQuickSettingsFlow, currentCategoryName, route.params.categoryName, route.params.policyID, backTo],
);
What alternative solutions did you explore? (Optional)N/A |
@JmillsExpensify, @abdulrahuman5196 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@abdulrahuman5196 any thoughts on the latest proposal posted? |
Hi, Checking now |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Checking now again |
Hi, I am still unable to repro the issue. I reached out in C+ channel to see, if any one is able to repro this and takeover. |
I am able to reproduce taking over! @JmillsExpensify please assign me here Screen.Recording.2024-11-14.at.12.21.22.AM.mov |
I consistently reproduce it by creating a new workspace for each test rather than reusing the same one. |
@JmillsExpensify Kindly assign this issue to @allgandalf . Unassigning myself. |
bump for assignment @JmillsExpensify |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] 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 #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
Bug6622187_1727880113686.az_recorder_20241002_162644.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @abdulrahuman5196The text was updated successfully, but these errors were encountered: