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

[$500] Switch to focus mode modal appears every time sign out and sign in for same account #37580

Closed
1 of 6 tasks
m-natarajan opened this issue Mar 1, 2024 · 26 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@m-natarajan
Copy link

m-natarajan commented Mar 1, 2024

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.46-0
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: @iwiznia
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1709229575556299

Action Performed:

  1. Have an account with many chats
  2. Have your message Priority mode setting set tomost recent mode
  3. Sign out and sign back in
  4. See the "switch to focus mode" modal is shown and you are switched to focus mode
  5. Switch your message Priority mode setting tomost recent mode
  6. Sign out and sign back in

Expected Result:

The account's message Priority mode should not be switched to #focus mode, nor should the #focus mode modal appear since the account should not be in #focus mode.

Actual Result:

The switch to focus mode modal is shown and you are switched to focus mode

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

Add any screenshot/video evidence

Recording.2808.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f91501e19c2b41b5
  • Upwork Job ID: 1765136631800881152
  • Last Price Increase: 2024-03-05
  • Automatic offers:
    • ishpaul777 | Reviewer | 0
    • bernhardoj | Contributor | 0
Issue OwnerCurrent Issue Owner: @johncschuster
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 1, 2024
Copy link

melvin-bot bot commented Mar 1, 2024

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

@Krishna2323

This comment was marked as off-topic.

@dukenv0307
Copy link
Contributor

dukenv0307 commented Mar 1, 2024

Proposal

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

  • Switch to focus mode modal appears every time sign out and sign in for same account

What is the root cause of that problem?

  • Calling API UpdateChatPriorityMode to set the focus mode will also set tryFocusMode: true (by BE `s response). But when singing out, we clear tryFocusMode key, that leads to the condition here return false, so the switch to focus mode modal appears.

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

  • We can keep the tryFocusMode when signing out. For example, add tryFocusMode key to this

What alternative solutions did you explore? (Optional)

  • When user signs in, BE can return tryFocusMode

Update:

Currently, BE return nvp_tryFocusMode after sigining in. So we can use this key rather than tryFocusMode

Improvement:

  • We are calling the tryFocusModeUpdate with 300ms delay:
    const autoSwitchToFocusMode = debounce(tryFocusModeUpdate, 300, {leading: true});
  • This can lead to the case that focus mode is not set if the reports data is not fetched successfully when tryFocusModeUpdate is called. We can improve it as we did with onboard modal here. Below is the detail:
  1. In here, create a useEffect that its dependences are whatever the tryFocusModeUpdate depends on. It will be something as:
    useEffect(() => {
        tryFocusModeUpdate(reports, hasTriedFocusMode, ...);
    }, [isLoadingApp]);
  1. Then update the withOnyx in here to subscribe to the above data

  2. Update the tryFocusModeUpdate to receive the reports, hasTriedFocusMode, ... as params

@CortneyOfstad CortneyOfstad removed the Bug Something is broken. Auto assigns a BugZero manager. label Mar 1, 2024
@CortneyOfstad CortneyOfstad removed their assignment Mar 1, 2024
@CortneyOfstad CortneyOfstad added the Bug Something is broken. Auto assigns a BugZero manager. label Mar 1, 2024
Copy link

melvin-bot bot commented Mar 1, 2024

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

@CortneyOfstad
Copy link
Contributor

Hi @johncschuster! This issue was assigned to me after I went OoO last night, so reassigning. Thanks!

@bernhardoj
Copy link
Contributor

Proposal

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

Switch to focus mode modal appears and the priority mode is switched to focus every time a user signs out and signs in back.

What is the root cause of that problem?

In tryFocusModeUpdate, we check for hasTriedFocusMode value. If it's true, we won't switch it to focus mode. However, after sign-in, hasTriedFocusMode is null. We already guard the function to wait until all required data is available,

function tryFocusModeUpdate() {
isReadyPromise.then(() => {

but we only check whether hasTriedFocusMode is undefined or not.

function checkRequiredData() {
if (allReports === undefined || hasTriedFocusMode === undefined || isInFocusMode === undefined || isLoadingReportData) {
return;
}
resolveIsReadyPromise();
}

The hasTriedFocusMode value could be null because it's cleared when we sign out. That's why the type is either boolean, undefined, or null.

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

In checkRequiredData, return early if hasTriedFocusMode is undefined or null.

Or even better, we can just check if hasTriedFocusMode is not a boolean.

@melvin-bot melvin-bot bot added the Overdue label Mar 4, 2024
Copy link

melvin-bot bot commented Mar 4, 2024

@johncschuster Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot removed the Overdue label Mar 5, 2024
@johncschuster
Copy link
Contributor

I've clarified the repro steps and am adding the External label.

@johncschuster johncschuster added the External Added to denote the issue can be worked on by a contributor label Mar 5, 2024
@melvin-bot melvin-bot bot changed the title Switch to focus mode modal appears every time sign out and sign in for same account [$500] Switch to focus mode modal appears every time sign out and sign in for same account Mar 5, 2024
Copy link

melvin-bot bot commented Mar 5, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01f91501e19c2b41b5

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 5, 2024
Copy link

melvin-bot bot commented Mar 5, 2024

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

@ishpaul777
Copy link
Contributor

ishpaul777 commented Mar 8, 2024

@dukenv0307 @bernhardoj Thanks you for you proposal!

@dukenv0307 your primary solution might cause a regression when the next time user sign in with any other account. and alternative solution looks like a fix from backend is required but here i think solution from @bernhardoj works welll enough!

@bernhardoj root cause from your proposal makes sense and solution also test well!

@bernhardoj Proposal LGTM!
🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Mar 8, 2024

Triggered auto assignment to @techievivek, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot added the Overdue label Mar 11, 2024
@johncschuster
Copy link
Contributor

@ishpaul777 just to clarify, are you suggesting above that I assign this one to @bernhardoj?

@melvin-bot melvin-bot bot removed the Overdue label Mar 11, 2024
@ishpaul777
Copy link
Contributor

ah yes! updated the comment to clarify

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 12, 2024
Copy link

melvin-bot bot commented Mar 12, 2024

📣 @ishpaul777 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Mar 12, 2024

📣 @bernhardoj 🎉 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 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Mar 12, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @ishpaul777

@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Apr 5, 2024
Copy link

melvin-bot bot commented Apr 5, 2024

This issue has not been updated in over 15 days. @johncschuster, @techievivek, @bernhardoj, @ishpaul777 eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@techievivek
Copy link
Contributor

Closing this as per this comment #38115 (comment) since the issue is no longer reproducible.

@bernhardoj
Copy link
Contributor

@techievivek @johncschuster Are we at least eligible for partial payment since we've done some work on the PR?

I think I ever seen some cases where the contributor is due to partial payment when they did their work on the PR but get closed because the issue is not reproducible anymore, but I could be wrong, so asking to be sure

@ishpaul777
Copy link
Contributor

ishpaul777 commented Apr 8, 2024

Yeah i feel there should be a compensation for the issue, For clarity, as per C+ docs why i think this is due for payment:

  1. Proposals was reviewed by me and a proposal was selected and contributor was hired.
  2. Contributor(@bernhardoj) worked on the PR and i tested and reviewed the changes and found BE related bug that was blocking the PR, then the original issue was no longer reproducable.

@techievivek
Copy link
Contributor

techievivek commented Apr 9, 2024

Sorry, yeah, I do think we need to compensate here. I will reopen the issue so John can look into payment. Thanks.

@techievivek techievivek reopened this Apr 9, 2024
@techievivek
Copy link
Contributor

Going to DM John to take a look into the payments here.

@techievivek techievivek added Daily KSv2 and removed Monthly KSv2 labels Apr 19, 2024
@johncschuster
Copy link
Contributor

Sorry I missed the GH notif! I'll get payment sorted today!

@ishpaul777
Copy link
Contributor

@johncschuster gentle bump!

@johncschuster
Copy link
Contributor

Sorry for the delay! I've issued payment through Upwork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

8 participants