You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-01-24] [$500] Workspace - Invite message does not remain when refresh page #32835
Version Number: 1.4.11-1 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: 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 staging.new.expensify.com
Navigate to Settings> Workspace> Members> Invite
Select few members to invite and click Next
Add random invite message and confirm Invite button
Refresh the page
Repeat steps 2 & 3
Expected Result:
Once entered invite message should remain when invite more users when refresh the page
Actual Result:
Invite message does not remain when refresh page
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
changed the title [-]Workspace - Invite message does not remain when refresh page[/-][+][$500] Workspace - Invite message does not remain when refresh page[/+]on Dec 11, 2023
But after we refresh the page, somehow the selector of onyx returns undefined value and will return the correct value for the 2nd render or after reopening the page. That's why the message from Onyx is empty and we get the default message.
What changes do you think we should make in order to solve the problem?
I haven't dug deeper into the onyx code as to why selector gives an undefined value after refresh, but removing the selector will fix the issue. We previously used the selector when the message is in the form of an object.
Please re-state the problem that we are trying to solve in this issue.
Workspace - Invite message does not remain when refresh page
What is the root cause of that problem?
The issue here is a simple case of react lifecycle no aligning with the intended behaviour, the welcomeNote is a state variable with a default value of either this.props.workspaceInviteMessageDraft or this.getDefaultWelcomeNote(), But workspaceInviteMessageDraft is populated from an asynchronous data fetch, therefore on the component mounting it will be empty and the code will default to the default welcome message.
What changes do you think we should make in order to solve the problem?
We already have a componentDidUpdate being used to ensure state variables are populated correctly so we just have to add a simple check in there to ensure that the welcomeNote is included
withOnyx() will delay the rendering of the wrapped component until all keys/entities have been fetched and passed to the component
And, we know that whether all the keys/entities have been fetched or not based on the value, if any key have value is undefined, so its data is not fetched, if any key have value is nulll, so its data is fetched successfully and have null value.
that always returns a value that is not undefined value. And as I mentioned above, it will consider that all the keys have been fetched successfully but the fact is that the workspaceInviteMessageDraft `s data is not fetched, and goes to render the wrapped component, in this case, is WorkspaceInviteMessage page.
Then, it will set the message invite with the default message:
A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: N.A.
Determine if we should create a regression test for this bug. No
If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again - N.A.
changed the title [-][$500] Workspace - Invite message does not remain when refresh page[/-][+][HOLD for payment 2024-01-24] [$500] Workspace - Invite message does not remain when refresh page[/+]on Jan 24, 2024
Activity
[-]Workspace - Invite message does not remain when refresh page[/-][+][$500] Workspace - Invite message does not remain when refresh page[/+]melvin-bot commentedon Dec 11, 2023
Triggered auto assignment to @bfitzexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Dec 11, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01e780374dd3bf487d
melvin-bot commentedon Dec 11, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Dec 11, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane (
External)bernhardoj commentedon Dec 11, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Refreshing the web app and revisiting the workspace invite message page won't show the previously saved invite message.
What is the root cause of that problem?
In workspace invite message page, we get the message from the onyx and use a selector.
App/src/pages/workspace/WorkspaceInviteMessagePage.js
Lines 264 to 267 in eebd7ee
Then, in the component constructor, we set the message state to the message from onyx if found.
App/src/pages/workspace/WorkspaceInviteMessagePage.js
Lines 84 to 86 in eebd7ee
But after we refresh the page, somehow the
selectorof onyx returnsundefinedvalue and will return the correct value for the 2nd render or after reopening the page. That's why the message from Onyx is empty and we get the default message.What changes do you think we should make in order to solve the problem?
I haven't dug deeper into the onyx code as to why

selectorgives an undefined value after refresh, but removing the selector will fix the issue. We previously used the selector when the message is in the form of an object.But now the selector is useless.
AmjedNazzal commentedon Dec 11, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Workspace - Invite message does not remain when refresh page
What is the root cause of that problem?
The issue here is a simple case of react lifecycle no aligning with the intended behaviour, the
welcomeNoteis a state variable with a default value of eitherthis.props.workspaceInviteMessageDraftorthis.getDefaultWelcomeNote(), ButworkspaceInviteMessageDraftis populated from an asynchronous data fetch, therefore on the component mounting it will be empty and the code will default to the default welcome message.App/src/pages/workspace/WorkspaceInviteMessagePage.js
Lines 84 to 86 in bc77287
What changes do you think we should make in order to solve the problem?
We already have a
componentDidUpdatebeing used to ensure state variables are populated correctly so we just have to add a simple check in there to ensure that thewelcomeNoteis includedResult
Screen.Recording.2023-12-11.at.11.45.38.PM.mov
DylanDylann commentedon Dec 12, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
undefined, so its data is not fetched, if any key have value isnulll, so its data is fetched successfully and havenullvalue.App/src/pages/workspace/WorkspaceInviteMessagePage.js
Lines 264 to 267 in 4239252
that always returns a value that is not
undefinedvalue. And as I mentioned above, it will consider that all the keys have been fetched successfully but the fact is that the workspaceInviteMessageDraft `s data is not fetched, and goes to render the wrapped component, in this case, is WorkspaceInviteMessage page.App/src/pages/workspace/WorkspaceInviteMessagePage.js
Line 85 in 4239252
What changes do you think we should make in order to solve the problem?
What alternative solutions did you explore? (Optional)
22 remaining items
fix workspace invitation message still preserved
rushatgabhane commentedon Jan 17, 2024
The PR that introduced the bug has been identified. Link to the PR: Fix/30992: Workspace invitation message still preserved #31770
The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: https://github.com/Expensify/App/pull/31770/files#r1454592244
A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: N.A.
Determine if we should create a regression test for this bug. No
If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again - N.A.
rushatgabhane commentedon Jan 17, 2024
PR on prod 1 week ago. @bfitzexpensify could you please attach a payment summary. Thank you 🙇
[-][$500] Workspace - Invite message does not remain when refresh page[/-][+][HOLD for payment 2024-01-24] [$500] Workspace - Invite message does not remain when refresh page[/+]DylanDylann commentedon Jan 26, 2024
@bfitzexpensify Could you help to move forward this issue?
JmillsExpensify commentedon Jan 30, 2024
I'll step in on this one, as Ben is OOO.
Payment summary:
JmillsExpensify commentedon Jan 30, 2024
@DylanDylann Your contract has been paid out.
JmillsExpensify commentedon Jan 30, 2024
$500 payment approved for @rushatgabhane based on summary above.
JmillsExpensify commentedon Jan 30, 2024
Closing this issue, as no regression test is required.