[HOLD for payment 2021-12-15] “Cannot remove yourself from workspace” banner is shown over and over again while inviting a new member - Reported by: @aswin-s
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
- Navigate to add member screen
- Tap on check box against own account once.
- Now tap on invite button to invite a new member
- The banner keeps on popping up.
- Even sending app to background and resuming or swiping down from notification panel also shows same behaviour.
Expected Result:
Banner notifying the user that own account can't be removed from workspace should show only one.
Actual Result:
Banner keeps showing up after clicking on invite button.
Workaround:
Force closing and reopening the app fixes the issue.
Platform:
Where is this issue occurring?
- iOS
- Android
- Mobile Web
Version Number: 1.1.14-0
Reproducible in staging?: Yes Reproducible in production?: Yes
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
https://user-images.githubusercontent.com/44479856/141533150-4efe7d47-86af-4cc8-b2e8-def1047a7601.MP4
Upwork job post: https://www.upwork.com/jobs/~01a1b16b70fceaf5f1
Issue reported by: @aswin-s Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1636709473156600
Triggered auto assignment to @sketchydroide (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
For some reason, I am not able to reproduce this by following the given reproduction steps. I am unable to click the own admin checkbox itself. It shows the following tooltip. @isagoico Can you help with some clarity on the reproduction steps?

My bad! I just updated the platforms affected. This is only reproducible in mobile.
Thanks @isagoico.
This definetly sounds like a bug, specialy for being platform specific. Also setting this as an external.
Triggered auto assignment to @michaelhaxhiu (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
Proposed Solution:
Here is the Problem: It is calling componentDidUpdate() method when goes to background. https://github.com/Expensify/App/blob/6701446b6dd7d77049fd399dcf6a042e6d05cae1/src/components/CheckboxWithTooltip/CheckboxWithTooltipForMobileWebAndNative.js#L14-L20
Solution: Put condition at line 19 i.e. If toggleTooltip change run Growl, otherwise not. This will correct the issue.
componentDidUpdate(prevProps) {
if (!this.props.toggleTooltip) {
return;
}
if (prevProps.toggleTooltip !== this.props.toggleTooltip) {
Growl.show(this.props.text, this.props.growlType, 3000);
}
}
Here is screen record, it works as expected with this solution:
iOS
https://user-images.githubusercontent.com/7823358/141803738-a9f48c97-d643-49c0-bb21-513fcd1fd91f.mov
Android
https://user-images.githubusercontent.com/7823358/141804110-6921ea00-99d4-44bb-9bf6-12fca15f9b71.mp4
Mobile Web
https://user-images.githubusercontent.com/7823358/141803880-76bc08db-b49d-4260-b083-79fe99ef47db.mov
Proposal
This bug is occurring because in willTooltipShowForLogin function, in case when workspace owner wants to remove himself, this code this.setState({showTooltipForLogin: login}); allows to show popUp, but showTooltipForLogin state variable's value will be always login and popup will be shown over and over again.
https://github.com/Expensify/App/blob/6701446b6dd7d77049fd399dcf6a042e6d05cae1/src/pages/workspace/WorkspaceMembersPage.js#L154-L156
The simpest way to fix it is to set showTooltipForLogin variable value " " after popUp was shown first time, like this:
if (!canBeRemoved) {
this.setState({showTooltipForLogin: login});
setTimeout(() => this.setState({showTooltipForLogin: ''}), 100);
}
https://user-images.githubusercontent.com/71173662/141808605-635fd59a-953a-41cc-a64c-405428c34755.MP4
https://user-images.githubusercontent.com/71173662/141814747-e033fea1-cd39-4a1d-8e4b-61f1f7a674f0.mp4
https://user-images.githubusercontent.com/71173662/141815505-1897643e-8a11-4f58-98c6-741d31c7d6ee.mov
Upwork job post: https://www.upwork.com/jobs/~01a1b16b70fceaf5f1
- ✅ I hired @aswin-s, so that they are paid the bug reporting bonus (i.e. if/when this bug is fixed).
- Next, I'll hire the contributor we choose to actually solve the problem. Looks like @PrashantMangukiya's proposal is the first to review.
We should have 2 hires for this job basically.
Triggered auto assignment to @johnmlee101 (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@PrashantMangukiya I like your proposal! https://github.com/Expensify/App/issues/6287#issuecomment-968998459 let's go with that.
📣 @PrashantMangukiya You have been assigned to this job by @johnmlee101! Please apply to this job in Upwork and let us know when we can expect a PR to be ready for review 🧑💻 Keep in mind: Code of Conduct | Contributing 📖
Next, I'll hire the contributor we choose to actually solve the problem. Looks like @PrashantMangukiya's proposal is the first to review.
Done ✅ - @PrashantMangukiya you are hired on Upwork.
Thanks @michaelhaxhiu Preparing pr now and submit asap.
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.1.18-3 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
- https://github.com/Expensify/App/pull/6542
If no regressions arise, payment will be issued on 2021-12-15. :confetti_ball:
Both contributors are paid.