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

[HOLD for payment 2024-01-28] CRITICAL: [$500] Switching from most recent to #focus shows already-read chats in the LHN #34466

Closed
1 of 6 tasks
isagoico opened this issue Jan 12, 2024 · 37 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@isagoico
Copy link

isagoico commented Jan 12, 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: v1.4.24-7
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: No
Email or phone of affected tester (no customers): All
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @roryabraham
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1705098619607699

Action Performed:

Precondition: User must have several conversations and no unread chats. Priority mode is set to Most Recent

  1. Refresh the page
  2. Without taking other actions - Navigate to preferences and enable #focus in priority mode

Expected Result:

Only the current report should be visible in the LHN

Actual Result:

The LHN remains unchanged (or at least, many unread chats remain visible in the LHN)

Workaround:

If the user takes other actions before refreshing, the issue is not reproduced.

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

Reprod.in.prod.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0111ebc2af8eb5ed14
  • Upwork Job ID: 1745951096565080064
  • Last Price Increase: 2024-01-12
  • Automatic offers:
    • bernhardoj | Contributor | 28106614
Issue OwnerCurrent Issue Owner: @zanyrenney
@isagoico isagoico added External Added to denote the issue can be worked on by a contributor Daily KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors Bug Something is broken. Auto assigns a BugZero manager. labels Jan 12, 2024
@melvin-bot melvin-bot bot changed the title Switching from most recent to #focus shows already-read chats in the LHN [$500] Switching from most recent to #focus shows already-read chats in the LHN Jan 12, 2024
Copy link

melvin-bot bot commented Jan 12, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0111ebc2af8eb5ed14

Copy link

melvin-bot bot commented Jan 12, 2024

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

Copy link

melvin-bot bot commented Jan 12, 2024

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

@bernhardoj
Copy link
Contributor

Proposal

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

Switching from the most recent fo #focus mode still shows all read chats

What is the root cause of that problem?

When we change the priority mode, it will recalculate the chats that should be shown on the LHN.

const optionListItems = useMemo(() => {
const reportIDs = SidebarUtils.getOrderedReportIDs(null, chatReports, betas, policies, priorityMode, allReportActions);
if (deepEqual(reportIDsRef.current, reportIDs)) {
return reportIDsRef.current;
}
// We need to update existing reports only once while loading because they are updated several times during loading and causes this regression: https://github.com/Expensify/App/issues/24596#issuecomment-1681679531
// However, if the user is offline, we need to update the reports unconditionally, since the loading of report data might be stuck in this case.
if (!isLoading || !reportIDsRef.current || network.isOffline) {
reportIDsRef.current = reportIDs;
}
return reportIDsRef.current || [];
}, [allReportActions, betas, chatReports, policies, priorityMode, isLoading, network.isOffline]);

It will first compare with the existing list whether something has changed or not, then, we will only get the updated list IF the app is not loading (!isLoading).

However, we have an issue where the isLoading onyx data is stuck at true. This happened before because we are ignoring the successData and failureData if the onyx updates from the server haven't changed, then we fix it by making sure both successData or failureData is always applied even when that case happen.

But this problem arose again because, in #33530, we are adding a new property called finallyData that we haven't included the case yet for the onyx update ignore fix.

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

We should include finallyData to be processed even when the onyx updates from the server haven't changed.

// In this case, we're already received the OnyxUpdate included in the response, so we don't need to apply it again.
// However, we do need to apply the successData and failureData from the request
if (type === CONST.ONYX_UPDATE_TYPES.HTTPS && request && response && (!isEmptyObject(request.successData) || !isEmptyObject(request.failureData))) {
Log.info('[OnyxUpdateManager] Applying success or failure data from request without onyxData from response');
// We use a spread here instead of delete because we don't want to change the response for other middlewares
const {onyxData, ...responseWithoutOnyxData} = response;
return applyHTTPSOnyxUpdates(request, responseWithoutOnyxData);
}

|| !isEmptyObject(request.finallyData)

Another issue:

But another thing I notice with this switching mode is that the list could be late to be updated because we ignore the updates if isLoading is true which I think makes sense when we load the app for the first time because we want to wait for the OpenApp API to be fully complete first.

if (!isLoading || !reportIDsRef.current || network.isOffline) {
reportIDsRef.current = reportIDs;
}

However, this becomes a problem when we switch from focus to most recent because it will also call OpenApp, so if we switch from focus -> most recent -> focus, we will see all read chats in the 2nd focus mode for a few seconds before the OpenApp completes.

Screen.Recording.2024-01-13.at.15.50.52.mov

We can fix this by adding another condition that checks if the priority mode is updated, then we will update the list.

const prevPriorityMode = usePrevious(priorityMode)

if (... || (prevPriorityMode !== priorityMode))
    // update the list
}

@melvin-bot melvin-bot bot added the Overdue label Jan 15, 2024
@zanyrenney
Copy link
Contributor

@parasharrajat please review the proposal and let me know what you think.

@quinthar
Copy link
Contributor

Added to #vip-vsb, thanks so much for taking this on! It's blocking #33619, which is a pretty important one.

@zanyrenney
Copy link
Contributor

@parasharrajat
Copy link
Member

Reviewing...

@parasharrajat
Copy link
Member

@bernhardoj's proposal is spot on.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Jan 17, 2024

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

@dangrous
Copy link
Contributor

This sounds great! Assigning.

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

melvin-bot bot commented Jan 17, 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 📖

@quinthar
Copy link
Contributor

What's the ETA for this?

@quinthar quinthar changed the title [$500] Switching from most recent to #focus shows already-read chats in the LHN CRITICAL: [$500] Switching from most recent to #focus shows already-read chats in the LHN Jan 18, 2024
@quinthar
Copy link
Contributor

What's the ETA for review?

@bernhardoj
Copy link
Contributor

The PR is merged

@dangrous
Copy link
Contributor

Yep! This is on staging now, being QAd

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jan 21, 2024
@melvin-bot melvin-bot bot changed the title CRITICAL: [$500] Switching from most recent to #focus shows already-read chats in the LHN [HOLD for payment 2024-01-28] CRITICAL: [$500] Switching from most recent to #focus shows already-read chats in the LHN Jan 21, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 21, 2024
Copy link

melvin-bot bot commented Jan 21, 2024

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

Copy link

melvin-bot bot commented Jan 21, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.28-0 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 2024-01-28. 🎊

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

Copy link

melvin-bot bot commented Jan 21, 2024

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:

  • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR:
  • [@parasharrajat] 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:
  • [@parasharrajat] 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:
  • [@parasharrajat] Determine if we should create a regression test for this bug.
  • [@parasharrajat] 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.
  • [@zanyrenney] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@parasharrajat
Copy link
Member

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:

Regression Test Steps

  1. Open the app
  2. Go to priority mode settings
  3. Switch the priority mode between Most Recent and #focus multiple times
  4. Verify the LHN list is updated correctly (Most Recent should show all chats, #focus should hide read chats)

Do you agree 👍 or 👎 ?

@garrettmknight
Copy link
Contributor

@parasharrajat I'm trying to figure out whether the PR that caused this is right. #34466 was discovered in v1.4.24-7 and the deploy blocker slack thread shows it in production. #33530 was deployed to staging in 1.4.24-4, to production in 1.4.24-8. Are you sure that's the right one?

@garrettmknight
Copy link
Contributor

@parasharrajat bump on the above

@parasharrajat
Copy link
Member

parasharrajat commented Jan 29, 2024

Hmm, I was also a little confused by this. I tried to pinpoint the PR where I finallyData was added. IMO, PR should have similarly handled the other cases like they were done for successData or failureData.

It might be possible that logic related to this issue was refactored later in some other PR which triggered this issue.

I could use some help here if we want to know the exact PR that made the bug noticeable.

@dangrous
Copy link
Contributor

So based on the solve, as well as this being a user (Expensify employee) reported bug, I think this may be one of those bugs that's been there pretty much since the beginning, we maybe just didn't notice it? We didn't appear to have regression tests that would catch it so it'll be unclear when it started.

That might be a cop out, though - I didn't investigate too long - but it feels like it might be the case

@dangrous
Copy link
Contributor

dangrous commented Feb 1, 2024

let me know what you think of that ^ @garrettmknight and @parasharrajat.

@parasharrajat
Copy link
Member

It is possible. I think we are fine with the above-linked PR. IMO PR could have solved this issue if the finallyData case was implemented as well.

@dangrous
Copy link
Contributor

dangrous commented Feb 2, 2024

Yeah I think it's kind of a mix - the bug existed likely since the beginning, and then that linked PR could have fixed it but didn't since it didn't apply the onyx updates for finallydata

@dangrous
Copy link
Contributor

dangrous commented Feb 6, 2024

Following up on this @garrettmknight @zanyrenney should we investigate this further, or are we good to move forward on payment?

@garrettmknight
Copy link
Contributor

Hey @dangrous - no need to investigate further. We're good to pay out here.

@dangrous
Copy link
Contributor

dangrous commented Feb 7, 2024

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

Great! @zanyrenney we're ready to go here - thanks!

@zanyrenney
Copy link
Contributor

Thanks @danieldoglas

@zanyrenney
Copy link
Contributor

payment summary:

@parasharrajat requires payment through NewDot Manual Requests - please request $500 for this issue
@bernhardoj requires payment automatic offer (Contributor)**** paid $500 via upwork!

@parasharrajat
Copy link
Member

Payment requested as per #34466 (comment)

@JmillsExpensify
Copy link

$500 approved for @parasharrajat

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. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
No open projects
Status: CRITICAL
Development

No branches or pull requests

8 participants