[$500] [Wave 8] [Ideal Nav] Workspace switcher - "Expensify" and workspace are ticked when returning from workspace
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: 1.4-36.0 Reproducible in staging?: Y Reproducible in production?: N If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4264387 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:
- Open workspace switcher
- Click +
- Click browser back button
Expected Result:
Only "Expensify" will be selected
Actual Result:
"Expensify" and the previous workspace are ticked at the same time
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [ ] Android: Native
- [ ] Android: mWeb Chrome
- [ ] iOS: Native
- [ ] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/89434aab-aec5-4dc9-a799-a0a2205225fc
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~01e52e8d993f5ba021
- Upwork Job ID: 1753506244878921728
- Last Price Increase: 2024-02-02
- Automatic offers:
- situchan | Reviewer | 28149266
- esh-g | Contributor | 28149267
:wave: Friendly reminder that deploy blockers are time-sensitive β± issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
- Identify the pull request that introduced this issue and revert it.
- Find someone who can quickly fix the issue.
- Fix the issue yourself.
Triggered auto assignment to @amyevans (Engineering), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.
We think that this bug might be related to #vip-vsp CC @quinthar
Proposal
Please re-state the problem we are trying to fix
"Expensify" and workspace are ticked when returning from workspace
Root cause
The root cause of this issue is that at first when we don't have an active workspace set, and open workspace switcher, we are on route: https://dev.new.expensify.com:8082/workspace-switcher. At this point ActiveWorkspaceID is undefined so the expensify icon is ticked.
The activeWorkspaceID is always based on route and navigation state.
When we create new workspace, the route becomes https://dev.new.expensify.com:8082/workspace/32DF7AB51CD026CA/overview which means the activeWorkspaceID gets set to 32DF7AB51CD026CA (based on navigation state), and when we click back once again, we go to the original route: https://dev.new.expensify.com:8082/workspace-switcher, at this point the activeWorkspaceID becomes undefined again as there is no ID in the route.
But the code for selecting the workspace icon doesn't update if the activeWorkspacecID is undefined here:
https://github.com/Expensify/App/blob/e6ea03b9278029acacb424856b58dee2d1134d9d/src/pages/WorkspaceSwitcherPage.tsx#L281-L286
What changes should be made to fix this?
We should modify this code:
https://github.com/Expensify/App/blob/e6ea03b9278029acacb424856b58dee2d1134d9d/src/pages/WorkspaceSwitcherPage.tsx#L281-L286
And remove the if condition and early return, thus allowing the setSelectedOption to be set to undefined which it should be as we are going back to the point where there was not an activeWorkspace.
Result
https://github.com/Expensify/App/assets/77237602/3a7e0f40-f6df-40e9-b5aa-c2a256b7cb7f
What alternative did you explore?
We can also use Navigation.goBack() before we create a new workspace here:
https://github.com/Expensify/App/blob/e6ea03b9278029acacb424856b58dee2d1134d9d/src/pages/WorkspaceSwitcherPage.tsx#L218-L220
This will make sure that the workspace switcher was closed before new workspace was created so user can't navigate back to it.
This is the same approach we take while switching active policy here:
https://github.com/Expensify/App/blob/e6ea03b9278029acacb424856b58dee2d1134d9d/src/pages/WorkspaceSwitcherPage.tsx#L112-L115
Result
https://github.com/Expensify/App/assets/77237602/2dcaf8dc-37fc-42e4-8d52-d93c11937f37
PS: I would prefer the alternate solution instead of the main one.
This is a regression from Ideal Nav, but it's pretty minor so doesn't need to block deploy. Confirmed it's not a dupe of any issues listed in https://github.com/orgs/Expensify/projects/94/views/2.
Triggered auto assignment to @isabelastisser (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Job added to Upwork: https://www.upwork.com/jobs/~01e52e8d993f5ba021
Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (External)
@situchan, can you please review the proposal above? Thanks!
Bump @situchan. Please let me know if you would like me to reassign this. Thanks!
sorry reviewing now
@esh-g's alternative solution looks good to me. π π π C+ reviewed
Current assignee @amyevans is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.
π£ @situchan π An offer has been automatically sent to your Upwork account for the Reviewer role π Thanks for contributing to the Expensify app!
π£ @esh-g π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
@esh-g @situchan let's priorizite this! Can you please share an update? Thanks!
@isabelastisser automation failed here. PR was deployed to production already. Mar 6 is payment date
@situchan, great, thanks for the heads up!
The payments were processed in Upwork.
- @esh-g Reviewer $500
- @situchan Contributor $500
All set!