Skip to content
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

[WAITING FOR PAYMENT MAY 29] [$250] Categories & Tags - App closes RHP instead of returning to previous RHP after saving name #41339

Closed
m-natarajan opened this issue Apr 30, 2024 · 20 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@m-natarajan
Copy link

m-natarajan commented Apr 30, 2024

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: 1.4.68-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause Internal Team
Slack conversation:

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace settings.
  3. Go to Taxes.
  4. Click on the tax rate > Name.
  5. Edit the name and save it.
  6. Note that RHP still opens after saving the name. The same behavior is seen with distance rates.
  7. Go to Categories.
  8. Click on the category > Category name.
  9. Edit the category name and save it.
  10. Repeat Step 7-9 with tags.

Expected Result:

App will return to previous RHP (with toggle, three-dot menu and name) after saving the category name, which is the behavior with taxes and distance rates.

Actual Result:

RHP closes after saving category and tag name.

Workaround:
Unknown

Platforms:
Which of our officially supported platforms is this issue occurring on?

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence

Bug6466672_1714486645846.20240430_221313.mp4

View all open jobs on GitHub

@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 30, 2024
Copy link

melvin-bot bot commented Apr 30, 2024

Triggered auto assignment to @abekkala (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.

@m-natarajan
Copy link
Author

@abekkala FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors.

@m-natarajan
Copy link
Author

We think this bug might be related to #wave-collect - Release 1

@neonbhai
Copy link
Contributor

neonbhai commented Apr 30, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

App closes RHP instead of returning to previous RHP after saving name

What is the root cause of that problem?

We dismiss the RHP explicitly when editing Category in CategoryForm

Navigation.dismissModal();

This is called after submitting the form.

What changes do you think we should make in order to solve the problem?

We should call Navigation.goBack() instead of Navigation.dismissModal() here:

Navigation.dismissModal();

Alternatively:

We can remove Navigation.dismissModal() from CategoryForm and handle the navigation in EditCategoryPage:
add here:

Navigation.goBack(ROUTES.WORKSPACE_CATEGORY_SETTINGS.getRoute(policyID, categoryName));

@Nodebrute
Copy link
Contributor

Nodebrute commented Apr 30, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Categories & Tags - App closes RHP instead of returning to previous RHP after saving name

What is the root cause of that problem?

We are dismissing modal instead of goBack

Navigation.dismissModal();

What changes do you think we should make in order to solve the problem?

Remove Navigation.dismissModal()

Navigation.dismissModal();

if (currentCategoryName !== newCategoryName) {
Policy.renamePolicyCategory(route.params.policyID, {oldName: currentCategoryName, newName: values.categoryName});
}

In the code block above, use Navigation.goBack with true as the second argument. If we just use goBack(), the URL will change due to the name change, causing the user to be redirected to a 'not found' page. We can do something like this

Navigation.goBack(ROUTES.WORKSPACE_CATEGORY_SETTINGS.getRoute(route.params.policyID, newCategoryName),true);

Optional
Instead of adding navigation logic in EditCategoryPage.tsx we can add it in the place of Navigation.dismissModal().

Navigation.dismissModal();

We should do the same thing for tags

const editTag = useCallback(
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.WORKSPACE_TAG_FORM>) => {
const tagName = values.tagName.trim();
// Do not call the API if the edited tag name is the same as the current tag name
if (currentTagName !== tagName) {
Policy.renamePolicyTag(route.params.policyID, {oldName: currentTagName, newName: values.tagName.trim()});
}
Keyboard.dismiss();
Navigation.dismissModal();
},
[route.params.policyID, currentTagName],
);

Note

We should use new category name or new tag name instead of categoryName/currentTagName

What alternative solutions did you explore?

We can use Navigation.navigate here.

@melvin-bot melvin-bot bot added the Overdue label May 2, 2024
@abekkala abekkala added the External Added to denote the issue can be worked on by a contributor label May 2, 2024
@melvin-bot melvin-bot bot changed the title Categories & Tags - App closes RHP instead of returning to previous RHP after saving name [$250] Categories & Tags - App closes RHP instead of returning to previous RHP after saving name May 2, 2024
Copy link

melvin-bot bot commented May 2, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0136827bdfe625bc6c

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 2, 2024
Copy link

melvin-bot bot commented May 2, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @akinwale (External)

@melvin-bot melvin-bot bot removed the Overdue label May 2, 2024
@abekkala
Copy link
Contributor

abekkala commented May 2, 2024

@akinwale we've already received some proposals! 🎉

@nkdengineer
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Categories & Tags - App closes RHP instead of returning to previous RHP after saving name

What is the root cause of that problem?

We dismiss the modal here so after editing category/tag name, App closes RHP

Navigation.dismissModal();

What changes do you think we should make in order to solve the problem?

  1. We should use goBack method here so we can navigate to the previous RHP

Navigation.dismissModal();

  1. But if we do that, the not found page will appear because the old category name is removed. To fix this we can update a new field in optimisticData like previousCategoryName here

[policyCategory.newName]: {

and we will use this to get the new category in CategorySettingPage

const policyCategory = policyCategories?.[route.params.categoryName] ?? Object.values(policyCategories ?? {}).find((category) => category.previousCategoryName === route.params.categoryName);

const policyCategory = policyCategories?.[route.params.categoryName];

OPTIONAL: In CategorySettingsPage, we can also change the categoryName param if the new category name is updated

useEffect(() => {
    if (policyCategory?.name === route.params.categoryName || !policyCategory) {
        return;
    }
    navigation.setParams({categoryName: policyCategory?.name});
}, [route.params.categoryName, policyCategory?.name])

Do the same way for Tag page

Note: We should not fallback goBack to the CategorySettingsPage with new category name param because if we do that when we click on back button again after going back to CategorySettingsPage not found page will appear.

What alternative solutions did you explore? (Optional)

For point 2: we can change the struct of policyCategories and policyTags the same as taxRates and then when we edit the name or other fields we will edit the value of the category and not change the id. But it will be a big refactor and require the backend change.

[category_id]: Category

@akinwale
Copy link
Contributor

akinwale commented May 5, 2024

@Nodebrute's proposal makes sense here.

🎀👀🎀 C+ reviewed.

Copy link

melvin-bot bot commented May 5, 2024

Triggered auto assignment to @blimpich, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@nkdengineer
Copy link
Contributor

@akinwale The selected proposal will cause the regression as this video. When we edit tag and back to tag setting page and click on the back button, not found page will appear instead of go back to tags page.

Can you please check my proposal #41339 (comment)? It can cover this case as well.

Screen.Recording.2024-05-05.at.19.57.23.mov

@akinwale
Copy link
Contributor

akinwale commented May 6, 2024

@akinwale The selected proposal will cause the regression as this video. When we edit tag and back to tag setting page and click on the back button, not found page will appear instead of go back to tags page.

I tested the proposal with the second parameter for goBack set to true, and it doesn't navigate to the not here page. However, there is another regression with that approach where the "Not here" page flickers for a bit before it actually displays the previous screen.

Considering this, @nkdengineer's proposal has the correct approach to solving the issue.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 6, 2024
@blimpich
Copy link
Contributor

blimpich commented May 6, 2024

👍 Sounds good. Feel free to raise a PR @nkdengineer. For some reason the automation for commenting on this issue with a confirmation of the contract offer didn't work, but we can proceed business as usual and make sure that everything gets paid out as normal.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels May 7, 2024
@nkdengineer
Copy link
Contributor

The PR is here.

@abekkala
Copy link
Contributor

Deployed to Production May 22
The payment date would be May 29, pending no regressions

@abekkala abekkala changed the title [$250] Categories & Tags - App closes RHP instead of returning to previous RHP after saving name [WAITING FOR PAYMENT MAY 29] [$250] Categories & Tags - App closes RHP instead of returning to previous RHP after saving name May 28, 2024
@abekkala
Copy link
Contributor

abekkala commented May 29, 2024

PAYMENT SUMMARY:

@abekkala
Copy link
Contributor

@akinwale payment sent and contract ended - thank you! 🎉

@nkdengineer
Copy link
Contributor

@abekkala I accepted the offer, thanks!

@abekkala
Copy link
Contributor

@nkdengineer payment sent and contract ended - thank you! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
No open projects
Archived in project
Development

No branches or pull requests

7 participants