Skip to content

Fix workspace list empty state not showing immediate - #14156

Merged
NikkiWines merged 5 commits into
Expensify:mainfrom
jatinsonijs:show-workspace-list-empty-state-immediate
Jan 12, 2023
Merged

NikkiWines merged 5 commits into
Expensify:mainfrom
jatinsonijs:show-workspace-list-empty-state-immediate

Conversation

@jatinsonijs

Copy link
Copy Markdown
Contributor

Details

Fixed the issue of Workspace - the welcome message does not appear immediately after deleting the workspace.
Changes - While online filter out all the delete pending policy if it not have an error.

Fixed Issues

$ #13615
PROPOSAL: #13615 (comment)

Tests

  1. Login with any account.
  2. Go to Settings -> Workspace (you should have only one workspace, if more than one delete them).
  3. Click on workspace to navigate to workspace detail page.
  4. Click on 3 dot and click on "Delete workspace".
  5. Confirm the modal to delete the workspace.
  6. It will navigate to workspace list page.
  7. Verify welcome message (empty list message) appear immediately.
  • Verify that no errors appear in the JS console

Offline tests

  1. Login with any account.
  2. Go to Settings -> Workspace (you should have only one workspace, if more than one delete them).
  3. Disable the internet connection in the device.
  4. Click on workspace to navigate to workspace detail page.
  5. Click on 3 dot and click on "Delete workspace".
  6. Confirm the modal to delete the workspace.
  7. It will navigate to workspace list page.
  8. Verify the workspace is now displayed with a strikethrough indicating it will be deleted when back online.
  9. Enable the internet connection in the device.
  10. Verify welcome message (empty list message) appear immediately.

QA Steps

  1. Login with any account.
  2. Go to Settings -> Workspace (you should have only one workspace, if more than one delete them).
  3. Click on workspace to navigate to workspace detail page.
  4. Click on 3 dot and click on "Delete workspace".
  5. Confirm the modal to delete the workspace.
  6. It will navigate to workspace list page.
  7. Verify welcome message (empty list message) appear immediately.
  • 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 / Chrome
    • iOS / native
    • iOS / 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 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
    • 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 correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • 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 a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • 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(themeColors.componentBG)
  • 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 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.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
workspace-web.mov
Mobile Web - Chrome
workspace-android-web.mov
Mobile Web - Safari
workspace-ios-web.mov
Desktop
workspace-desktop.mov
iOS
workspace-ios.mov
Android
workspace-android.mov

@jatinsonijs
jatinsonijs requested a review from a team as a code owner January 9, 2023 19:40
@melvin-bot
melvin-bot Bot requested review from aimane-chnaif and removed request for a team January 9, 2023 19:40
@melvin-bot

melvin-bot Bot commented Jan 9, 2023

Copy link
Copy Markdown

@NikkiWines @aimane-chnaif One of you needs to 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]

@NikkiWines NikkiWines left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor comment wording suggestion, otherwise looks great and works perfectly 🚀

Comment thread src/libs/PolicyUtils.js Resolved
@parasharrajat

Copy link
Copy Markdown
Member

I should be assigned as reviewer to this PR @NikkiWines can you please correct the assignment.

@jatinsonijs

jatinsonijs commented Jan 10, 2023 •

Copy link
Copy Markdown
Contributor Author

@parasharrajat do you have any feedback, any other changes required ?

@parasharrajat

Copy link
Copy Markdown
Member

I am AFK. I will review it when I am back.

@aimane-chnaif

Copy link
Copy Markdown
Contributor

I am confused that I am assigned here though it seems @jatinsonijs linked issue correctly. Shall I review PR as well?

@parasharrajat

parasharrajat commented Jan 10, 2023 •

Copy link
Copy Markdown
Member

@aimane-chnaif No, it is expected in my issues due to some internal reason and we are aware of it. You can ignore this issue for now. Thanks.

@NikkiWines
NikkiWines requested review from parasharrajat and removed request for aimane-chnaif January 10, 2023 17:43
@jatinsonijs

jatinsonijs commented Jan 11, 2023 •

Copy link
Copy Markdown
Contributor Author

@parasharrajat sorry for bothering you again, can you plz look into this. If we can merge within 3 days it will be better.

Comment thread src/libs/PolicyUtils.js Outdated
Comment on lines +62 to +63
* @param {boolean} isOffline
* @returns {boolean}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* @param {boolean} isOffline
* @returns {boolean}
* @param {Boolean} isOffline
* @returns {Boolean}

Comment thread src/libs/PolicyUtils.js
&& policy.type === CONST.POLICY.TYPE.FREE
&& policy.role === CONST.POLICY.ROLE.ADMIN
&& (
isOffline

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

let's use a subscription at the top of the file.

Onyx.connect({
    key: ONYXKEYS.NETWORK,
    callback: val => isNetworkOffline = lodashGet(val, 'isOffline', false),
});

then remove the isOffline param.

@jatinsonijs jatinsonijs Jan 11, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@parasharrajat I think in this way it can create race condition. Like if shouldShowPolicy function call before updation of value isNetworkOffline. because both function are independent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have just tested it with subscription it's not working correctly. It takes time to show welcome message.

@parasharrajat parasharrajat Jan 11, 2023 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok. Let's keep it this way then. Let's put a comment on the function for future ref.

Using a local ONYXKEYS.NETWORK subscription will cause a delay in updating the screen, pass the offline status from the component.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@parasharrajat comment added

@parasharrajat

parasharrajat commented Jan 11, 2023 •

Copy link
Copy Markdown
Member

I am testing it ATM. There are a few strange behaviors that may not be related to this PR.

@jatinsonijs

Copy link
Copy Markdown
Contributor Author

I am testing it ATM. There are a few strange behaviors that may not be related to this PR.

@parasharrajat I think you are facing problem like if we do quick actions like create and delete sometime workspace reappear for few secs. this issue already in discussion in different GH issue.

@parasharrajat

Copy link
Copy Markdown
Member

That too. But I also faced a strange issue with offline behavior. I will try to document it. This makes it hard to test the PRs as we can't guarantee that the changes will work for all the cases.

@jatinsonijs

jatinsonijs commented Jan 11, 2023 •

Copy link
Copy Markdown
Contributor Author

@parasharrajat I think this PR related to only welcome message not showing immediately which was regression of an issue fixes. where delete pending condition was removed. So we have added back this condition to exact match offline component condition:
const hideChildren = !props.network.isOffline && props.pendingAction === 'delete' && !hasErrors;

@parasharrajat

Copy link
Copy Markdown
Member

Yeah, I got it. It is only left to be tested on a few platforms. I will add the videos on few miniutes.

@parasharrajat

parasharrajat commented Jan 12, 2023 •

Copy link
Copy Markdown
Member

Screenshots

🔲 iOS / native

screen-2023-01-12_07.36.27.mp4

🔲 iOS / Safari

screen-2023-01-12_07.43.03.mp4

🔲 MacOS / Desktop

screen-2023-01-12_07.34.54.mp4

🔲 MacOS / Chrome

screen-2023-01-12_05.50.11.mp4

🔲 Android / Chrome

screen-2023-01-12_07.11.00.mp4

🔲 Android / native

screen-2023-01-12_07.27.29.mp4

@parasharrajat parasharrajat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • 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 steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (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 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
    • 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 correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • 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 verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • 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
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • 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(themeColors.componentBG)
  • 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 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

cc: @NikkiWines

🎀 👀 🎀 C+ reviewed

@jatinsonijs

Copy link
Copy Markdown
Contributor Author

@NikkiWines I think you have already reviewed the PR. Can you plz try to approve ASAP. We are very near to 3 days deadline 🙂

@jatinsonijs

This comment was marked as off-topic.

@NikkiWines NikkiWines left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 looks good.

@NikkiWines
NikkiWines merged commit 8649636 into Expensify:main Jan 12, 2023
@OSBotify

Copy link
Copy Markdown
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.

@NikkiWines

Copy link
Copy Markdown
Contributor

@jatinsonijs I appreciate the urgency and I'll talk to @mallenexpensify about the 3-day deadline. However, this was approved under 24 hours ago (and after 6pm in the timezone I'm in), so I only just now had a chance to re-review. Please be aware that there are lots of other commitments and multiple bumps within such a short time period doesn't necessarily get a reviewer to look quicker.

@jatinsonijs

jatinsonijs commented Jan 12, 2023 •

Copy link
Copy Markdown
Contributor Author

I understand @NikkiWines, I didn't want to disturb you. I was just trying my best to make it merge within 3 days.

@github-actions

Copy link
Copy Markdown
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
App start TTI 641.357 ms → 653.591 ms (+12.234 ms, +1.9%)
App start runJsBundle 176.313 ms → 178.188 ms (+1.875 ms, +1.1%)
App start nativeLaunch 20.645 ms → 21.094 ms (+0.449 ms, +2.2%)
App start regularAppStart 0.019 ms → 0.020 ms (+0.001 ms, +4.0%)
Open Search Page TTI 616.035 ms → 610.543 ms (-5.492 ms, -0.9%)
Show details
Name Duration
App start TTI Baseline
Mean: 641.357 ms
Stdev: 29.574 ms (4.6%)
Runs: 584.12268400006 592.938047000207 605.8499790001661 607.8295219996944 610.5932290004566 610.8063610000536 613.5782049996778 614.1235680002719 615.0699460003525 620.3011549999937 624.237398000434 629.0571799995378 635.442250999622 637.0772660002112 637.8928559999913 640.5689960001037 640.9457289995626 642.5225039999932 647.1785239996389 647.2068389998749 650.7251209998503 651.7435600003228 655.4116359995678 657.8350259996951 665.2134880004451 666.6746840002015 669.3330269996077 677.2701890002936 681.0797170000151 690.4228480001912 696.8809070000425 703.47906600032

Current
Mean: 653.591 ms
Stdev: 29.896 ms (4.6%)
Runs: 598.0639169998467 606.1011180002242 615.0643440000713 616.9995799995959 617.1889059999958 617.4375320002437 625.5136740002781 628.9638510001823 632.9843629999086 637.0659029996023 642.522357000038 644.6460870001465 645.6071939999238 646.8415230000392 649.0126590002328 650.9131650002673 653.6806600000709 656.0329210003838 658.1979719996452 658.3466029996052 658.3543779999018 658.5100109996274 672.9520349996164 673.9145910004154 674.0426120003685 684.5047909999266 684.9472439996898 685.5421609999612 691.3556530000642 698.8879089998081 714.1389629999176 716.5721789998934
App start runJsBundle Baseline
Mean: 176.313 ms
Stdev: 18.644 ms (10.6%)
Runs: 153 154 155 157 158 158 159 160 161 164 167 167 167 168 169 172 174 176 176 178 179 180 184 188 191 193 193 194 195 208 208 236

Current
Mean: 178.188 ms
Stdev: 16.183 ms (9.1%)
Runs: 148 149 153 154 156 164 166 167 172 172 172 172 173 173 173 173 177 181 181 184 186 187 190 192 193 193 194 194 196 198 205 214
App start nativeLaunch Baseline
Mean: 20.645 ms
Stdev: 1.788 ms (8.7%)
Runs: 18 19 19 19 19 19 19 19 19 20 20 20 20 20 20 20 20 20 20 21 21 21 21 22 22 22 23 23 24 25 25

Current
Mean: 21.094 ms
Stdev: 1.826 ms (8.7%)
Runs: 18 18 18 18 19 19 19 20 20 20 21 21 21 21 21 21 21 21 22 22 22 22 22 22 22 23 23 23 23 23 23 26
App start regularAppStart Baseline
Mean: 0.019 ms
Stdev: 0.001 ms (6.9%)
Runs: 0.015990999527275562 0.016724000684916973 0.016927000135183334 0.0176189998164773 0.01765899918973446 0.017782000824809074 0.017822000198066235 0.018066000193357468 0.018066000193357468 0.01806699950248003 0.018146999180316925 0.0181470001116395 0.01818800065666437 0.018228999339044094 0.01822900027036667 0.0186769999563694 0.01871699932962656 0.018757999874651432 0.019286999478936195 0.019328000023961067 0.019449999555945396 0.019491000100970268 0.019531000405550003 0.0195720000192523 0.019816000014543533 0.02018200047314167 0.020305000245571136 0.020507999695837498 0.020548000000417233 0.0206709997728467 0.020793000236153603 0.02193199936300516

Current
Mean: 0.020 ms
Stdev: 0.001 ms (5.0%)
Runs: 0.017904000356793404 0.018025999888777733 0.018106999807059765 0.018554999493062496 0.018797999247908592 0.01896199956536293 0.01908399909734726 0.019125000573694706 0.019245999865233898 0.019368999637663364 0.0194089999422431 0.0194089999422431 0.0194089999422431 0.0194089999422431 0.01948999986052513 0.019491000100970268 0.019531000405550003 0.01953200064599514 0.019652999937534332 0.0197350000962615 0.019816000014543533 0.019937999546527863 0.020223000086843967 0.02026400063186884 0.020508000627160072 0.020995999686419964 0.020995999686419964 0.0213620001450181 0.022461000829935074
Open Search Page TTI Baseline
Mean: 616.035 ms
Stdev: 24.065 ms (3.9%)
Runs: 568.215046999976 572.702677000314 576.769164999947 591.3143720002845 594.31665099971 594.3959559993818 598.6944989999756 599.3769120005891 599.9144699992612 600.8563639996573 605.5538739999756 605.7652179999277 606.2778329998255 607.7334389993921 611.0430499995127 615.2290049996227 616.8542889999226 617.1363120004535 617.1960049998015 617.4259439995512 617.4615479996428 622.5694580003619 625.0313729997724 627.7359629999846 629.3723550001159 635.0710039995611 641.671875 642.0989180002362 642.6119800005108 643.0242109997198 644.1492919996381 668.2999269999564 673.2956139994785

Current
Mean: 610.543 ms
Stdev: 22.013 ms (3.6%)
Runs: 569.9551599994302 571.909953000024 576.2298590000719 579.0896410001442 580.0961920004338 582.7363689998165 589.9802249995992 590.7295739995316 595.8948570005596 596.0296630002558 599.4738360000774 601.8581140004098 604.9822999993339 606.4842940000817 608.0664480002597 610.3307290002704 613.1309810001403 614.5828050002456 616.825521000661 619.4249269999564 620.7418219996616 621.7347419997677 621.9334720000625 623.4831139994785 625.3511960003525 630.6574310008436 632.0008140001446 633.7803960004821 634.5409350004047 636.0562740005553 639.8790689995512 648.7309980001301 651.2118330001831

@OSBotify OSBotify mentioned this pull request Jan 13, 2023
13 tasks done
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by @NikkiWines in version: 1.2.54-0 🚀

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by @AndrewGable in version: 1.2.54-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.

5 participants