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
[$500] Chat-Infinite loading occurs if conversation ID is edited to 0 #32651
Version Number: 1.4.9-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: Applause-Internal Team Slack conversation: @
changed the title [-]Chat-Infinite loading occurs if conversation ID is edited to 0[/-][+][$500] Chat-Infinite loading occurs if conversation ID is edited to 0[/+]on Dec 7, 2023
What changes do you think we should make in order to solve the problem?
We should check if isLoadingInitialReportActions but reportID is invalid we will not show loading page. Instead, we will show not found page by create a variable like isValidReportIDFromPath
isValidReportIDFromPath = ReportUtils.isValidReportIDFromPath(reportIDFromPath)
// If has no reportID in param, it means we are setting reportID in `ReportScreenIDSetter`
const hasReportIDFromParam = !!route.params.reportID;
And then update the condition to show not found page with this variable.
Please re-state the problem that we are trying to solve in this issue.
Infinite loading occurs occurs if reportID = 0
What is the root cause of that problem?
We validate reportIDhere and early return if invalid before calling OpenReport which sets isLoadingInitialReportActions to false optimistically.
So reportMetadata_0 is not set in Onyx and it fallback to this default object:
So isLoadingInitialReportActions is true and it doesn't meet shouldShowNotFoundPage condition
What changes do you think we should make in order to solve the problem?
define new flag. Let's say X! X = ReportUtils.isValidReportIDFromPath(reportID) && reportMetadata.isLoadingInitialReportActions
And replace all reportMetadata.isLoadingInitialReportActions occurrences with X in ReportScreen.js component
(optional) For existing users who already have stale reportMetadata_reportID in Onyx:
clear reportMetadata_reportID before early return here:
This is added to fix this issue where the app crashes if we send a "null" string as the report ID to the API, but I found it weird why it only happens with a "null" string and not other string such as "a". So, I'm trying to reproduce the issue without the fix above and it works fine (it's probably a temp BE issue).
So, currently, if we visit a report with an ID of 0 or null, the loading shows indefinitely, but visiting a report with an ID of other characters such as "a", the not found page will show, so it's a bit inconsistent with how we handle the report ID.
What changes do you think we should make in order to solve the problem?
I would suggest removing isValidReportIDFromPath. Let the BE handles any report ID we sent and the not found page will be shown if it's not found in the BE.
if (!reportIDFromPath) {
return;
}
What alternative solutions did you explore? (Optional)
Show the not found page if the report id is not empty and is invalid.
Sorry for not seeing this earlier, and thanks April for DMing me on NewDot. That's the best way to reach me. I haven't been checking my GH mentions since there are too many, however, I will start checking them daily so I don't miss things like this again.
Show the not found page if the report id is not empty and is invalid.
@alitoshmatov Ok I see, thanks for explaining. I'm happy with this, and I approve the alternate solution from @bernhardoj's proposal. Please continue with the PR and request my review after the C+ approves.
Activity
[-]Chat-Infinite loading occurs if conversation ID is edited to 0[/-][+][$500] Chat-Infinite loading occurs if conversation ID is edited to 0[/+]melvin-bot commentedon Dec 7, 2023
Job added to Upwork: https://www.upwork.com/jobs/~015ee46823d25664a9
melvin-bot commentedon Dec 7, 2023
Triggered auto assignment to @sophiepintoraetz (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Dec 7, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Dec 7, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @alitoshmatov (
External)dukenv0307 commentedon Dec 7, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Infinite loading occurs if conversation ID is edited to 0
What is the root cause of that problem?
When the
reportIDis0, we don't callopenReportAPI andisLoadingInitialReportActionsistrueby default prop. So infinite loading occursApp/src/pages/home/ReportScreen.js
Line 243 in b0268fa
What changes do you think we should make in order to solve the problem?
We should check if
isLoadingInitialReportActionsbutreportIDis invalid we will not show loading page. Instead, we will show not found page by create a variable likeisValidReportIDFromPathAnd then update the condition to show not found page with this variable.
What alternative solutions did you explore? (Optional)
NA
Result
Screen.Recording.2023-12-14.at.12.47.00.mov
Screen.Recording.2023-12-14.at.12.47.48.mov
mkhutornyi commentedon Dec 7, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Infinite loading occurs occurs if reportID =
0What is the root cause of that problem?
We validate
reportIDhere and early return if invalid before callingOpenReportwhich setsisLoadingInitialReportActionsto false optimistically.So
reportMetadata_0is not set in Onyx and it fallback to this default object:App/src/pages/home/ReportScreen.js
Lines 105 to 109 in b0268fa
So
isLoadingInitialReportActionsis true and it doesn't meet shouldShowNotFoundPage conditionWhat changes do you think we should make in order to solve the problem?
define new flag. Let's say X!
X = ReportUtils.isValidReportIDFromPath(reportID) && reportMetadata.isLoadingInitialReportActionsAnd replace all
reportMetadata.isLoadingInitialReportActionsoccurrences withXin ReportScreen.js component(optional) For existing users who already have stale
reportMetadata_reportIDin Onyx:clear
reportMetadata_reportIDbefore early return here:App/src/pages/home/ReportScreen.js
Lines 243 to 245 in b0268fa
so call this function:
yh-0218 commentedon Dec 7, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Infinite loading occurs occurs if reportID = 0
What is the root cause of that problem?
We didn't consider
isValidReportIDFromPathto getshouldShowNotFoundPageWhat changes do you think we should make in order to solve the problem?
We need to consider
isValidReportIDFromPathto getshouldShowNotFoundPageWhat alternative solutions did you explore? (Optional)
Screen.Recording.2023-12-07.at.2.59.55.PM.mov
bernhardoj commentedon Dec 7, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
When visiting a report with id of 0, the loading shows infinitely.
What is the root cause of that problem?
We currently prevent the open report API if the report id is 0, empty, or "null" string. This makes the report screen always show the skeleton loader.
App/src/pages/home/ReportScreen.js
Lines 241 to 245 in 8fa65ec
App/src/libs/ReportUtils.ts
Lines 3915 to 3917 in 8fa65ec
This is added to fix this issue where the app crashes if we send a "null" string as the report ID to the API, but I found it weird why it only happens with a "null" string and not other string such as "a". So, I'm trying to reproduce the issue without the fix above and it works fine (it's probably a temp BE issue).
So, currently, if we visit a report with an ID of 0 or null, the loading shows indefinitely, but visiting a report with an ID of other characters such as "a", the not found page will show, so it's a bit inconsistent with how we handle the report ID.
What changes do you think we should make in order to solve the problem?
I would suggest removing
isValidReportIDFromPath. Let the BE handles any report ID we sent and the not found page will be shown if it's not found in the BE.What alternative solutions did you explore? (Optional)
Show the not found page if the report id is not empty and is invalid.
52 remaining items
alitoshmatov commentedon Feb 5, 2024
@abekkala Since @neil-marcellini is not responding, can we get another internal engineer to take a look at this?
abekkala commentedon Feb 5, 2024
I've reached out to @neil-marcellini
neil-marcellini commentedon Feb 5, 2024
Sorry for not seeing this earlier, and thanks April for DMing me on NewDot. That's the best way to reach me. I haven't been checking my GH mentions since there are too many, however, I will start checking them daily so I don't miss things like this again.
@alitoshmatov Ok I see, thanks for explaining. I'm happy with this, and I approve the alternate solution from @bernhardoj's proposal. Please continue with the PR and request my review after the C+ approves.
melvin-bot commentedon Feb 13, 2024
@abekkala, @neil-marcellini, @bernhardoj, @alitoshmatov Whoops! This issue is 2 days overdue. Let's get this updated quick!
abekkala commentedon Feb 13, 2024
@bernhardoj do you have a PR up for this?
bernhardoj commentedon Feb 13, 2024
Yes, it was merged yesterday #33394
abekkala commentedon Feb 15, 2024
deployed to prod Feb 14
melvin-bot commentedon Feb 23, 2024
@abekkala, @neil-marcellini, @bernhardoj, @alitoshmatov Whoops! This issue is 2 days overdue. Let's get this updated quick!
abekkala commentedon Feb 23, 2024
7 day waiting period end has ended - no regressions
Fix: @bernhardoj [$500] Offer link
PR Review: @alitoshmatov [$500] Offer link
abekkala commentedon Feb 23, 2024
@bernhardoj and @alitoshmatov Upwork payments sent and contracts ended - thank you! 🎉
melvin-bot commentedon Mar 25, 2024
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.