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

Add workspace name as subtitle in individual modal screens #8065

Merged
merged 4 commits into from
Mar 14, 2022
Merged

Add workspace name as subtitle in individual modal screens #8065

merged 4 commits into from
Mar 14, 2022

Conversation

mollfpr
Copy link
Contributor

@mollfpr mollfpr commented Mar 10, 2022

Details

Adding workspace name that get from props withFullPolicy hoc and call the this.props.policy.name and pass it to HeaderWithCloseButton component.
Update workspace page included:

  1. Invite page - workspace/${policyID}/invite
  2. Settings page - workspace/${policyID}/settings
  3. Card page - workspace/${policyID}/card
  4. Reimburse page - workspace/${policyID}/reimburse
  5. Bills page - workspace/${policyID}/bills
  6. Invoices page - workspace/${policyID}/invoices
  7. Travel page - workspace/${policyID}/travel

Fixed Issues

$ #7840

Tests

Open workspace page, open the page below, and verify that the workspace name is shown in the modal header.

  1. Invite page - workspace/${policyID}/invite
  2. Settings page - workspace/${policyID}/settings
  3. Card page - workspace/${policyID}/card
  4. Reimburse page - workspace/${policyID}/reimburse
  5. Bills page - workspace/${policyID}/bills
  6. Invoices page - workspace/${policyID}/invoices
  7. Travel page - workspace/${policyID}/travel
  • Verify that no errors appear in the JS console

PR Review Checklist

Contributor (PR Author) Checklist

  • I verified the PR has a small number of commits behind main
  • 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 clearly indicated the environment tests should be run in (Staging vs Production)
  • I wrote testing steps that cover success & fail scenarios (if applicable)
  • I included screenshots or videos for tests on all platforms
  • I ran the tests & veryfy they passed on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • I verified there are no console errors related to changes in this PR
  • I followed proper code patterns (see Reviewing the code)
    • I added comments when the code was not self explanatory
    • I put all copy / text shown in the product in all src/languages/* files (if applicable)
    • I followed proper naming convention for platform-specific files (if applicable)
    • I followed style guidelines (in Styling.md) for all style edits I made
    • I followed the JSDocs style guidelines (in STYLE.md)
  • 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 corroborated the UI performance was not affected (the performance is the same than main branch)
  • If I created a new component I verified that a similar component doesn't exist in the codebase

PR Reviewer Checklist

  • I verified the PR has a small number of commits behind main
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the testing environment is mentioned in the test steps
  • I verified testing steps cover success & fail scenarios (if applicable)
  • I checked that screenshots or videos are included for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • I verified there are no console errors related to changes in this PR
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified comments were added when the code was not self explanatory
    • I verified any copy / text shown in the product was added in all src/languages/* files (if applicable)
    • I verified proper naming convention for platform-specific files was followed (if applicable)
    • I verified style guidelines were followed
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components are not impacted by changes in this PR (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 the UI performance was not affected (the performance is the same than main branch)
  • If a new component is created I verified that a similar component doesn't exist in the codebase

QA Steps

Open workspace page, open the page below, and verify that the workspace name is shown in the modal header.

  1. Invite page - workspace/${policyID}/invite
  2. Settings page - workspace/${policyID}/settings
  3. Card page - workspace/${policyID}/card
  4. Reimburse page - workspace/${policyID}/reimburse
  5. Bills page - workspace/${policyID}/bills
  6. Invoices page - workspace/${policyID}/invoices
  7. Travel page - workspace/${policyID}/travel
  8. Bank account page - workspace/${policyID}/bank-account
  • Verify that no errors appear in the JS console

Screenshots

Web

Screen.Recording.2022-03-08.at.18.13.21.mov

Mobile Web

Screen.Recording.2022-03-08.at.17.59.03.mov

Desktop

Screen.Recording.2022-03-08.at.18.01.34.mov

iOS

Screen.Recording.2022-03-08.at.18.11.17.mov

Android

Screen.Recording.2022-03-08.at.18.14.03.mov

@mollfpr mollfpr requested a review from a team as a code owner March 10, 2022 04:55
@MelvinBot MelvinBot requested review from Luke9389 and rushatgabhane and removed request for a team March 10, 2022 04:55
@mollfpr
Copy link
Contributor Author

mollfpr commented Mar 10, 2022

re-create from #8038

@rushatgabhane
Copy link
Member

rushatgabhane commented Mar 10, 2022

@mollfpr could you please merge main from upstream into your branch, thanks!
(51 commits behind)

Copy link
Member

@rushatgabhane rushatgabhane left a comment

Choose a reason for hiding this comment

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

@mollfpr looks like we're in an infinite loop.

  1. Go to Settings -> Workspace -> Connect bank account page
  2. Go back
Screen.Recording.2022-03-11.at.1.03.09.AM.mov

@mollfpr
Copy link
Contributor Author

mollfpr commented Mar 11, 2022

@rushatgabhane There's infinite loop render happen in hoc withFullPolicy. I think it's because useNavigationState keeps re-render.

const currentRoute = _.last(useNavigationState(state => state.routes || []));

I have 2 solutions for the problem

  1. using navigation getState() instead of useNavigationState hook. This will keep the component from re-render.
- const currentRoute = _.last(useNavigationState(state => state.routes || []));
+ const currentRoute = _.last(navigationRef.current.getState().routes);
  1. All this happens because when we try to redirect to workspace/:policyID/bank-account but we don't have any bank account yet so the WorkspaceBankAccountPage will redirect us to /bank-account/BankAccountStep with a function before rendering the page component. We can fix this with move the function call inside componentDidMount and the infinite loop will disappear.
    render() {
    if (!this.getShouldShowPage()) {
    this.navigateToBankAccountRoute();
    return null;
    }
    return (
    componentDidMount() {
        this.unsubscribe = this.props.navigation.addListener('focus', this.onScreenFocus);

        if (!this.getShouldShowPage()) {
            this.navigateToBankAccountRoute();
        }
    }

@rushatgabhane
Copy link
Member

@mollfpr fantastic work finding the solutions!

The problem with solution 1 is that path is undefined, i.e. it doesn't re-render when we actually want it to. The cause of infinite loop still exists, it just breaks the loop because we don't re-render.

All this happens because when we try to redirect to workspace/:policyID/bank-account but we don't have any bank account yet so the WorkspaceBankAccountPage will redirect us to /bank-account/BankAccountStep with a function before rendering the page component. We can fix this with move the function call inside componentDidMount and the infinite loop will disappear

I agree. This is the root cause, and it won't cause an infinite loop anymore.
Let's get this done!

@mollfpr
Copy link
Contributor Author

mollfpr commented Mar 14, 2022

@rushatgabhane @Luke9389 It's all set, ready for another review.

Copy link
Member

@rushatgabhane rushatgabhane left a comment

Choose a reason for hiding this comment

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

@Luke9389 LGTM! 🎉

PR Reviewer Checklist

  • I verified the PR has a small number of commits behind main
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the testing environment is mentioned in the test steps
  • I verified testing steps cover success & fail scenarios (if applicable)
  • I checked that screenshots or videos are included for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • I verified there are no console errors related to changes in this PR
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified comments were added when the code was not self explanatory
    • I verified any copy / text shown in the product was added in all src/languages/* files (if applicable)
    • I verified proper naming convention for platform-specific files was followed (if applicable)
    • I verified style guidelines were followed
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components are not impacted by changes in this PR (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 the UI performance was not affected (the performance is the same than main branch)
  • If a new component is created I verified that a similar component doesn't exist in the codebase

Copy link
Contributor

@Luke9389 Luke9389 left a comment

Choose a reason for hiding this comment

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

Good work, thanks @mollfpr

@Luke9389 Luke9389 merged commit 90e5af4 into Expensify:main Mar 14, 2022
@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.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @Luke9389 in version: 1.1.43-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @roryabraham in version: 1.1.43-2 🚀

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

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.

4 participants