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

[PAID] [$500] Web - Signing show empty content when pressing go back from another tab. #30288

Closed
1 of 6 tasks
kbecciv opened this issue Oct 24, 2023 · 38 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff

Comments

@kbecciv
Copy link

kbecciv commented Oct 24, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.3.90.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: @hungvu193
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1698145969463179

Action Performed:

Action Performed:

  1. Open 2 tabs
  2. Try to sign in with expensifail account at the first tab.
  3. At first tab, continue to choose Use magic code, after that press go back.
  4. Now move to the second tab.
  5. Notice that content of second tab is empty.

Expected Result:

Second tab should show the same content with the first tab.

Actual Result:

Content of the second tab is empty.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2023-10-24.at.18.13.53.mov
Recording.5138.mp4
MacOS: Desktop

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~011276a45d6462ac66
  • Upwork Job ID: 1716875205299765248
  • Last Price Increase: 2023-11-14
Issue OwnerCurrent Issue Owner: @situchan
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 24, 2023
@melvin-bot melvin-bot bot changed the title Web - Signing show empty content when pressing go back from another tab. [$500] Web - Signing show empty content when pressing go back from another tab. Oct 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

Job added to Upwork: https://www.upwork.com/jobs/~011276a45d6462ac66

@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

Triggered auto assignment to @strepanier03 (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (External)

@wlegolas
Copy link
Contributor

wlegolas commented Oct 24, 2023

Hi @kbecciv.

Maybe I'm wrong, but I think this is a limitation in the Web application.

In my analysis, I found a comment in the file below that explains why it can be a limitation.

import Str from 'expensify-common/lib/str';
const uniqueID = Str.guid();
/**
* Get the "unique ID of the device".
* Note deviceID is not truly unique but will be a new GUID each time the app runs (we work around this limitation by saving it in Onyx)
*
* This GUID is stored in Onyx under ONYXKEYS.DEVICE_ID and is preserved on logout, such that the deviceID will only change if:
*
* - The user opens the app on a different browser or in an incognito window, OR
* - The user manually clears Onyx data
*
* While this isn't perfect, it's just as good as any other obvious web solution, such as this one https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/deviceId
* which is also different/reset under the same circumstances
*
* @returns {Promise<String>}
*/
function generateDeviceID() {
return Promise.resolve(uniqueID);
}
export default generateDeviceID;

Just to bring more context, in my understanding, the deviceID is used to connect the current tab to the application state management. As the deviceID is the same in both tabs, the tabs will share the same application state.

@FitseTLT
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Sign in page show empty when we go back to login from validate code page in other tab

What is the root cause of that problem?

Although this code

Onyx.multiSet({
[ONYXKEYS.ACCOUNT]: null,
[ONYXKEYS.CREDENTIALS]: {},
});

is suppose to reset the credential value in onyx to {}, Onyx is not updating credential prop and rerendering the signin page on the other tab(the tab the user didn't press go back on)
therefore shouldShowLoginForm is set to true in the other tab because in this line
const shouldShowLoginForm = isClientTheLeader && !hasLogin && !hasValidateCode;

hasLogin will be true for the other tab (the tab the user didn't press go back) as the credential value is not updated properly in ONYX it still holds on the previous login email inserted from the original tab.

What changes do you think we should make in order to solve the problem?

Change this line
https://github.com/FitseTLT/App/blob/cc3c51c1d58ce013e444b59bd06c87e4b750e550/src/libs/actions/Session/index.ts#L578
to

        [ONYXKEYS.CREDENTIALS]: null,

to properly clear the credential data to the other tab. Now the credential prop updates properly on the other tab. It must be something related to the internal working of Onyx.
OPTIONALLY
Also separting the multiSet call

Onyx.multiSet({
[ONYXKEYS.ACCOUNT]: null,
[ONYXKEYS.CREDENTIALS]: {},
});

to separate onyx set

    Onyx.set(ONYXKEYS.ACCOUNT, null);
    Onyx.set(ONYXKEYS.CREDENTIALS, {});

updates the credentials prop properly in the other tab and it fixes the problem.
(Ofcourse there is some weird unexpected behaviour in the inner working of onyx but we can use either of the workarounds above and both work; here is a testimonial video below)
POC:

New.Expensify.mp4

What alternative solutions did you explore? (Optional)

@yh-0218
Copy link
Contributor

yh-0218 commented Oct 24, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Sign in page show empty when we go back to login from validate code page in other tab

What is the root cause of that problem?

when click "go back" on TabA, credentials.login = null on TabA, but credentials.login != null on TabB.
I think this is issue of withOnyx issue

What changes do you think we should make in order to solve the problem?

We can set individually to avoid this.

    Onyx.set(ONYXKEYS.ACCOUNT, null);
    Onyx.set(ONYXKEYS.CREDENTIALS, {});

on this.

Onyx.multiSet({
[ONYXKEYS.ACCOUNT]: null,
[ONYXKEYS.CREDENTIALS]: {},
});

What alternative solutions did you explore? (Optional)

@strepanier03
Copy link
Contributor

Okay, we are able to repro this pretty easily but I do wonder if this is a limitation based on the comment from @wlegolas here. Although it does seem like the more recent proposals identify this as an Onyx issue so perhaps there is no limitation?

2023-10-24_15-33-29.mp4

I'll wait for @situchan to weigh in because they're going to understand this much better than I do.

Thanks everyone!

@hungvu193
Copy link
Contributor

Coming from this discussion here: https://expensify.slack.com/archives/C049HHMV9SM/p1698145969463179

Proposal

Please re-state the problem that we are trying to solve in this issue.

Signing show empty content when pressing go back from another tab.

What is the root cause of that problem?

Recent changes in react-native-onyx recently broke the Onyx.multiset method this make credenticals didn't update in the second tabs which caused this issues.
I assume that it will be the regression of one of these 2 PRs:
Expensify/react-native-onyx#384 and Expensify/react-native-onyx#385

What changes do you think we should make in order to solve the problem?

Since we used multiset in many places in our App so in the meantime, when waiting for this is being fixed in react-native-onyx, I suggest that we should revert react-native-onyx to version 1.0.98.
(This issue is still reproducible with react-native-onyx 1.0.109).

What alternative solutions did you explore? (Optional)

N/A

@melvin-bot melvin-bot bot added the Overdue label Oct 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

@strepanier03, @situchan Huh... This is 4 days overdue. Who can take care of this?

@situchan
Copy link
Contributor

Anyone please jump in this issue and fix regression?
cc: @tgolen @ospfranco (tagging you since you were authors of Expensify/react-native-onyx#385, Expensify/react-native-onyx#384)

@melvin-bot melvin-bot bot removed the Overdue label Oct 30, 2023
@tgolen
Copy link
Contributor

tgolen commented Oct 30, 2023

Hm, I don't think those changes would cause this. To my knowledge, those changes aren't rolled out yet because main is still using Onyx v 1.0.100.

@tgolen
Copy link
Contributor

tgolen commented Oct 30, 2023

I would suggest using git bisect to try and locate the offending commit.

Copy link

melvin-bot bot commented Oct 31, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@situchan
Copy link
Contributor

Awaiting proposal with correct root cause and solution

@melvin-bot melvin-bot bot added the Overdue label Nov 3, 2023
@strepanier03
Copy link
Contributor

All good Melvin, waiting on proposals.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Nov 3, 2023
@strepanier03
Copy link
Contributor

Still waiting on proposals.

@melvin-bot melvin-bot bot removed the Overdue label Nov 6, 2023
Copy link

melvin-bot bot commented Nov 21, 2023

@strepanier03 @stitesExpensify @situchan this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:

  • Decide whether any proposals currently meet our guidelines and can be approved as-is today
  • If no proposals meet that standard, please take this issue internal and treat it as one of your highest priorities
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

@melvin-bot melvin-bot bot added Internal Requires API changes or must be handled by Expensify staff and removed External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors labels Nov 21, 2023
Copy link

melvin-bot bot commented Nov 21, 2023

Current assignee @situchan is eligible for the Internal assigner, not assigning anyone new.

@stitesExpensify
Copy link
Contributor

Let's go with @FitseTLT proposal to set the credentials to null

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Nov 21, 2023
@FitseTLT
Copy link
Contributor

@situchan PR ready 👍

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 29, 2023
@melvin-bot melvin-bot bot changed the title [$500] Web - Signing show empty content when pressing go back from another tab. [HOLD for payment 2023-12-06] [$500] Web - Signing show empty content when pressing go back from another tab. Nov 29, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 29, 2023
Copy link

melvin-bot bot commented Nov 29, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Nov 29, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.4-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-12-06. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter - @hungvu193 - $50 via Upwork
  • Contributor that fixed the issue - @FitseTLT - $500 via Upwork
  • Contributor+ that helped on the issue and/or PR - @situchan - $500 via Upwork

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Nov 29, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@situchan] The PR that introduced the bug has been identified. Link to the PR: N/A It came from Onyx, not a regression.
  • [@situchan] 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: N/A
  • [@situchan] 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
  • [@situchan] Determine if we should create a regression test for this bug?: No
  • [@situchan] 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.
  • [@strepanier03] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 Daily KSv2 labels Dec 5, 2023
@strepanier03
Copy link
Contributor

The job that was originally created for this in Upwork has been closed and Upwork is erroring when creating a new job.

I'll come back to this in an hour or two and see if Upwork will let me create the job.

@situchan
Copy link
Contributor

situchan commented Dec 6, 2023

BZ Checklist:
This came from Onyx. Not regression from app PR.
As this is rare case, it's not worthy of adding regression test.
If disagrees, we can use QA Steps in PR as regression test step.

@strepanier03
Copy link
Contributor

Sorry for the delay everyone, Upwork's job creation was done most of the day. I've hired all of you to the job in Upwork and will check in tomorrow to pay it out.

@strepanier03
Copy link
Contributor

This is all wrapped up and paid out. Thanks again everyone!

@strepanier03 strepanier03 changed the title [HOLD for payment 2023-12-06] [$500] Web - Signing show empty content when pressing go back from another tab. [PAID] [$500] Web - Signing show empty content when pressing go back from another tab. Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

No branches or pull requests

10 participants