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

Fix: Background report changes to Tags page after clicking Custom tag name in RHP #50416

Merged
merged 23 commits into from
Oct 22, 2024

Conversation

twilight2294
Copy link
Contributor

@twilight2294 twilight2294 commented Oct 8, 2024

Details

Fixed Issues

$ #49883
PROPOSAL: #49883 (comment)

Tests

  • Precondition:
  • User is logged in to two devices
  • Workspace has tags
  1. Open App
  2. [Device A] Go to workspace chat
  3. [Device A] Click + > Submit expense > Manual
  4. [Device A] Proceed to confirmation page and click Tag
  5. [Device B] Go to workspace settings > Tags
  6. [Device B] Disable all tags
  7. [Device A] Click Edit tags
  8. [Device A] Click Settings > Custom tag name

Verify that The report in the background will remain after clicking Custom tag name

Verify that in general the whole flow tests well and we are navigated to the correct pages.

Verify that following the same steps above for categories, we are navigated correctly on category pages

  • Verify that no errors appear in the JS console

Offline tests

N/A can't test offline

QA Steps

  • Precondition:
  • User is logged in to two devices
  • Workspace has tags
  1. Open App
  2. [Device A] Go to workspace chat
  3. [Device A] Click + > Submit expense > Manual
  4. [Device A] Proceed to confirmation page and click Tag
  5. [Device B] Go to workspace settings > Tags
  6. [Device B] Disable all tags
  7. [Device A] Click Edit tags
  8. [Device A] Click Settings > Custom tag name

Verify that The report in the background will remain after clicking Custom tag name

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen.Recording.2024-10-07.at.8.45.54.PM.mov
Android: mWeb Chrome
Screen.Recording.2024-10-07.at.8.48.45.PM.mov
iOS: Native
Screen.Recording.2024-10-07.at.8.44.21.PM.mov
iOS: mWeb Safari
Screen.Recording.2024-10-07.at.8.43.29.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-10-07.at.7.58.45.PM.mov
MacOS: Desktop
Screen.Recording.2024-10-07.at.8.03.38.PM.mov

Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
@twilight2294 twilight2294 marked this pull request as ready for review October 8, 2024 15:15
@twilight2294 twilight2294 requested a review from a team as a code owner October 8, 2024 15:15
@melvin-bot melvin-bot bot requested review from paultsimura and removed request for a team October 8, 2024 15:15
Copy link

melvin-bot bot commented Oct 8, 2024

@paultsimura Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@twilight2294
Copy link
Contributor Author

@paultsimura there is an additional bug in this flow that when we refresh the page and then press back button the RHP will get dismissed, this is reproducible on production as well. I think we can fix it too in this PR, should we ask for a bounty increase for this issue ?

@paultsimura
Copy link
Contributor

@paultsimura there is an additional bug in this flow that when we refresh the page and then press back button the RHP will get dismissed, this is reproducible on production as well. I think we can fix it too in this PR, should we ask for a bounty increase for this issue ?

Please add a recording – I cannot reproduce from this description.

@paultsimura
Copy link
Contributor

@koko57 sorry for bothering you here – I just know you are well familiar with routing in the App. Could you please briefly look across this PR and see if it makes sense to you, or we could simplify it by somehow only changing a part of the Screens config 🙏

It honestly looks a bit bulky for me to duplicate every existing tag-related route just because we want to show it in RHP in one flow, and the main window in another flow.

@twilight2294
Copy link
Contributor Author

twilight2294 commented Oct 8, 2024

Please add a recording – I cannot reproduce from this description.

Screen.Recording.2024-10-08.at.11.45.43.PM.mov

Should be reproducible on staging (not in this PR as i already included the fix for that (not part of our PR though, just for demonstration)

@koko57
Copy link
Contributor

koko57 commented Oct 9, 2024

@paultsimura yeah, I agree it's a bit bulky. But if it's already implemented this way for categories, I cannot argue with this approach. Same for Expensify Card - I wonder if we should also implement it this way.

@paultsimura
Copy link
Contributor

Thanks @koko57, maybe we'll come to some grand routing refactoring at some point that will allow supporting both full-page and RHP pages seamlessly.

@paultsimura
Copy link
Contributor

@stitesExpensify we have noticed a couple of semi-related bugs here:

Bug 1:

  1. Open App
  2. Go to a workspace chat
  3. Click + > Submit expense > Manual
  4. Proceed to the confirmation page and click "Tag"
  5. [Device B] Go to the workspace settings > Tags
  6. [Device B] Disable all tags
  7. Click Edit tags
  8. Click Settings > Custom tag name
  9. Refresh the page
  10. Click the "Back" button

Expected: the user is navigated back to the previous page in the RHP with the possibility to continue the money request submission
Actual: the RHP is closed and the draft money request is dismissed

Bug 2:

  1. Open App
  2. Go to a workspace chat
  3. Click + > Submit expense > Manual
  4. Proceed to the confirmation page and click "Tag"
  5. [Device B] Go to the workspace settings > Tags
  6. [Device B] Disable all tags
  7. Click Edit tags
  8. Click one of the tags in the list
  9. Click the tag name
  10. Refresh the page
  11. Modify the name and click "Save"

Expected: the changes are persisted and the user is navigated back to the previous page in the RHP with the possibility to continue the money request submission
Actual: the changes are persisted, but the RHP is closed and the draft money request is dismissed


Also, most scenarios we've fixed in this PR for Tags are still happening for Categories. Like refreshing the page on some steps, or clicking "Import spreadsheet" etc.

Would you be up to bumping the bounty to $500 here and let us take care of these flows more holistically?

@stitesExpensify
Copy link
Contributor

Yep @paultsimura let's double it to $500 and get those fixed! CC @Christinadobrzyn

@paultsimura
Copy link
Contributor

@twilight294 all yours again!

Signed-off-by: GitHub <noreply@github.com>
@twilight2294
Copy link
Contributor Author

@paultsimura can you review the updated code once? I will update the recordings after you have reviewed the code once

@paultsimura
Copy link
Contributor

@twilight294 please test the Categories flow as well and fix where needed - it also misses some screens and I promised we'll fix them for the increased bounty.

@twilight2294
Copy link
Contributor Author

@twilight294 please test the Categories flow as well and fix where needed - it also misses some screens and I promised we'll fix them for the increased bounty.

It's a little late here, I will add categories tomorrow, can you review for tags in the meantime ? thanks 😄

@paultsimura
Copy link
Contributor

It's midnight for me as well, will review tomorrow 👍

Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
@twilight2294
Copy link
Contributor Author

@twilight294 please test the Categories flow as well and fix where needed - it also misses some screens and I promised we'll fix them for the increased bounty.

Fixed @paultsimura

@twilight2294
Copy link
Contributor Author

@paultsimura missed to remove that extra param, thanks, I have updated the code, let me know if you have any more concerns

@paultsimura
Copy link
Contributor

Actually @twilight294 this is gonna sound like a little more work, but it would be much better for the code clarity – it's quite confusing when we use the ternary operator like this:

Navigation.navigate(backTo ? route_1 : route_2)

Let's introduce a new variable on all these pages (isEmpty from 'lodash/isEmpty'):

const isQuickSettingsFlow = !isEmpty(backTo);

And use it instead of backTo, e.g.:

Navigation.goBack(isQuickSettingsFlow ? ROUTES.SETTINGS_TAGS_SETTINGS.getRoute(route?.params?.policyID, backTo) : ROUTES.WORKSPACE_TAGS_SETTINGS.getRoute(route?.params?.policyID));

@twilight2294
Copy link
Contributor Author

thanks for the suggestions @paultsimura , implemented the changes

Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
@paultsimura
Copy link
Contributor

I'm sorry @twilight294 – I've double checked and it would be sufficient to use this instead of lodash:

const isQuickSettingsFlow = !!backTo;

This is the last change request, hopefully 🙏

Copy link
Contributor

@paultsimura paultsimura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 missed change.

@@ -126,7 +129,7 @@ function ImportedTagsPage({route}: ImportedTagsPageProps) {
>
<HeaderWithBackButton
title={translate('workspace.tags.importTags')}
onBackButtonPress={() => Navigation.goBack(ROUTES.WORKSPACE_TAGS_IMPORT.getRoute(policyID))}
onBackButtonPress={() => Navigation.goBack(backTo ? ROUTES.SETTINGS_TAGS_IMPORT.getRoute(policyID, backTo) : ROUTES.WORKSPACE_TAGS_IMPORT.getRoute(policyID))}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here as well, i guess:

Suggested change
onBackButtonPress={() => Navigation.goBack(backTo ? ROUTES.SETTINGS_TAGS_IMPORT.getRoute(policyID, backTo) : ROUTES.WORKSPACE_TAGS_IMPORT.getRoute(policyID))}
onBackButtonPress={() => Navigation.goBack(isQuickSettingsFlow ? ROUTES.SETTINGS_TAGS_IMPORT.getRoute(policyID, backTo) : ROUTES.WORKSPACE_TAGS_IMPORT.getRoute(policyID))}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed it sorry

Signed-off-by: GitHub <noreply@github.com>
@twilight2294
Copy link
Contributor Author

I updated the code @paultsimura , got rid of the lodash

Copy link
Contributor

@paultsimura paultsimura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite a big PR, I hope we didn't miss any test cases 🤞
LGTM ✔️

@twilight2294
Copy link
Contributor Author

bump for review @stitesExpensify

@stitesExpensify
Copy link
Contributor

I have been OOO but am working my way through this. Lots of changes!

@paultsimura
Copy link
Contributor

paultsimura commented Oct 21, 2024

@stitesExpensify any progress with this one? It's likely to accumulate conflicts over time because there are a lot of changes.

@stitesExpensify stitesExpensify merged commit faf48fc into Expensify:main Oct 22, 2024
17 of 18 checks passed
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

Copy link
Contributor

🚀 Deployed to staging by https://github.com/stitesExpensify in version: 9.0.53-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 cancelled 🔪
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Copy link
Contributor

🚀 Deployed to staging by https://github.com/stitesExpensify in version: 9.0.53-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@Julesssss
Copy link
Contributor

Hey all, it seems like this PR might have introduced a small issue with Tag pages navigation

@twilight2294
Copy link
Contributor Author

Looking.....

Copy link
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.53-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 cancelled 🔪
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Copy link
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.53-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 failure ❌
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@paultsimura
Copy link
Contributor

@twilight2294 what are your findings on this?

@twilight2294
Copy link
Contributor Author

Sorry, it's weekend so didn't reply early, found a fix, i will raise PR tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants