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] Deeplinks - Infinite loading displayed when user navigated on non-existing chat deeplink #33638

Closed
2 of 6 tasks
lanitochka17 opened this issue Dec 27, 2023 · 48 comments
Closed
2 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Dec 27, 2023

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.17.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:

Precondition: app should be killed

  1. Open app
  2. Open any existing coversation
  3. Hide the app
  4. Open non-existing coversation deeplink https://staging.new.expensify.com/r/1234

Expected Result:

User should be navigated on "You don't have access to this chat" page

Actual Result:

Infinite loading displayed

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

Bug6326513_1703637346495.Rpreplay_Final1703617339.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01bad93f473888207b
  • Upwork Job ID: 1739822788800614400
  • Last Price Increase: 2024-01-24
  • Automatic offers:
    • tienifr | Contributor | 28121883
@lanitochka17 lanitochka17 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 Dec 27, 2023
@melvin-bot melvin-bot bot changed the title Deeplinks - Infinite loading displayed when user navigated on non-existing chat deeplink [$500] Deeplinks - Infinite loading displayed when user navigated on non-existing chat deeplink Dec 27, 2023
Copy link

melvin-bot bot commented Dec 27, 2023

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

Copy link

melvin-bot bot commented Dec 27, 2023

Triggered auto assignment to @garrettmknight (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 Dec 27, 2023
Copy link

melvin-bot bot commented Dec 27, 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

Copy link

melvin-bot bot commented Dec 27, 2023

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

@tienifr
Copy link
Contributor

tienifr commented Dec 27, 2023

Proposal

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

Infinite loading displayed

What is the root cause of that problem?

We're reusing ReportScreen even though the reportID in route changes.

See here, when the reportID in route changes, the same ReportScreen instance will be used. So the wasReportAccessibleRef in here is still true, even though now it's a new report and it should be evaluated again. This causes the shouldShowNotFoundPage here to always be false, preventing the not found screen from opening.

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

Add route reportID as key of ReportScreen.

We can do this by modify this to

<ReportScreen route={route} key={getReportID(route)}/>

(The getReportID is the same as here)

What alternative solutions did you explore? (Optional)

If we want to keep the ReportScreen render shared between different reportIDs, we need to reset the wasReportAccessibleRef to false when the reportID from route change (and potentially the firstRenderRef to true as well), and modify the condition here so that it will not set wasReportAccessibleRef to false if the reportID of report and reportID from route doesn't match.

@wildan-m
Copy link
Contributor

wildan-m commented Dec 27, 2023

Proposal

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

Deeplinks - Infinite loading displayed when user navigated on non-existing chat deeplink

What is the root cause of that problem?

In native, ReportScreen is not actually unmounted when there is a change in reportID.

When the reportID known to be invalid it will hit this check in ReportScreen.

onyxReportID === prevReport.reportID && (!onyxReportID

onyxReportID and prevReport.reportID will be undefined.

This will cause infinite loading since isLoadingInitialReportActions never false and wasReportAccessibleRef.current will always be true.

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

When reportID known to be invalid, we can mark wasReportAccessibleRef.current and isLoadingInitialReportActions to false

        if ((onyxReportID === prevReport.reportID && (!onyxReportID || onyxReportID === routeReportID))) {
            if(!onyxReportID)
            {
                wasReportAccessibleRef.current = false;
                Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`, {isLoadingInitialReportActions: false});
            }
            return;
        }

@melvin-bot melvin-bot bot added the Overdue label Dec 29, 2023
@garrettmknight
Copy link
Contributor

@sobitneupane any thoughts on these proposals?

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Dec 29, 2023
Copy link

melvin-bot bot commented Jan 1, 2024

@garrettmknight, @sobitneupane Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@wildan-m
Copy link
Contributor

wildan-m commented Jan 2, 2024

My proposal updated with better solution

@garrettmknight
Copy link
Contributor

@sobitneupane can you give this one a look?

@melvin-bot melvin-bot bot removed the Overdue label Jan 2, 2024
Copy link

melvin-bot bot commented Jan 3, 2024

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

@sobitneupane
Copy link
Contributor

Sorry for the delay. I will review proposals shortly.

@sobitneupane
Copy link
Contributor

Thanks for the proposal @tienifr and @wildan-m

Both of the proposal solves the issue.

@wildan-m In your proposal, I don't think we need to set isLoadingInitialReportActions in onyx as the reportID is invalid and most probably we don't store metadata for invalid report.

Can we add wasReportAccessibleRef.current = false; here before returning? That will probably solve the issue.

useEffect(() => {
if (!report || !report.reportID || shouldHideReport) {
return;
}
wasReportAccessibleRef.current = true;
}, [shouldHideReport, report]);

@wildan-m
Copy link
Contributor

wildan-m commented Jan 5, 2024

@sobitneupane I've tried that, but it will cause not found page on previously accessible report.

  1. Open a report A
  2. go to android/ios home. minimize the app (without exit)
  3. Open a new deeplink with invalid report ID
  4. It should show not found page
  5. Press back header button, it will show not found page once more where the expected page should be report A

I think @tienifr proposal to add key to the ReportScreen is the best solution.

@wildan-m
Copy link
Contributor

wildan-m commented Jan 5, 2024

@sobitneupane also my last proposed solution has a glitch. it will show not found page for a brief moment when firstly joined public room

@melvin-bot melvin-bot bot added the Overdue label Jan 8, 2024
Copy link

melvin-bot bot commented Jan 8, 2024

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

@garrettmknight
Copy link
Contributor

@sobitneupane good to assign @tienfr here then?

@melvin-bot melvin-bot bot removed the Overdue label Jan 8, 2024
Copy link

melvin-bot bot commented Jan 24, 2024

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

Copy link

melvin-bot bot commented Jan 24, 2024

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

@marcochavezf
Copy link
Contributor

Sounds good, thanks @sobitneupane for the review, assigning @tienifr 🚀

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

melvin-bot bot commented Jan 25, 2024

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

@tienifr
Copy link
Contributor

tienifr commented Jan 26, 2024

PR ready for review #35228.

@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Feb 19, 2024
Copy link

melvin-bot bot commented Feb 19, 2024

This issue has not been updated in over 15 days. @garrettmknight, @marcochavezf, @sobitneupane, @tienifr 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!

@sobitneupane
Copy link
Contributor

I am expecting updates from @tienifr in the PR.

@sobitneupane
Copy link
Contributor

The issue was resolved by #36477 PR. So, we are going to close the PR #35228 created for this issue.

@marcochavezf
Copy link
Contributor

Oh then the issue is no longer reproducible in main, correct?

@marcochavezf marcochavezf added Weekly KSv2 and removed Monthly KSv2 labels Mar 5, 2024
@tienifr
Copy link
Contributor

tienifr commented Mar 6, 2024

@marcochavezf That's true.

@garrettmknight
Copy link
Contributor

Gotcha, gonna close in that case.

@tienifr
Copy link
Contributor

tienifr commented Mar 11, 2024

@garrettmknight Although the issue was fixed somewhere else, efforts have been made to implement, test and review carefully the PR. Please consider payment for this issue. Thanks!

@tienifr
Copy link
Contributor

tienifr commented Mar 14, 2024

@garrettmknight Can you check the above ^. Thanks 🙏

@garrettmknight
Copy link
Contributor

Hey @tienifr - missed the first comment. I think half payment is fair. I'll process now.

Summary of Payments:

@garrettmknight
Copy link
Contributor

@sobitneupane can you request payment when you get a chance?

@JmillsExpensify
Copy link

$250 approved for @sobitneupane based on summary.

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. Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants