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
[HOLD for payment 2023-12-12] [hold for payment 2023-11-16] [$500] Chat - Skeleton placeholder flickers when opening chat with IOU in offline mode #30503
Version Number: v1.3.92-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: @
Action Performed:
Precondition:
There must be a user with existing unpaid IOU.
Log out and log in again and do not open the chat report with the user that has existing IOU.
Go offline.
Go to + > Request money > Manual.
Request money from the user in the precondition.
If there is no flickering, click on the IOU preview to open IOU report.
Expected Result:
Skeleton placeholder should not flicker.
Actual Result:
Skeleton placeholder flickers.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
changed the title [-]Chat - Skeleton placeholder flickers when opening chat with IOU in offline mode[/-][+][$500] Chat - Skeleton placeholder flickers when opening chat with IOU in offline mode[/+]on Oct 27, 2023
When the reproduction steps are met, the API call responds with the following error:
{
"code": 666,
"jsonCode": 666,
"message": "No report actions returned in Auth response"
}
This leads to the isLoadingOlderReportActions being set to true as a failure data, and the Report.getOlderActions being triggered again, which results in a loop.
What changes do you think we should make in order to solve the problem?
Second, we should make the actual API call only if we are online:
const loadOlderChats = () => {
// Only fetch more if we are not already fetching so that we don't initiate duplicate requests.
- if (props.isLoadingOlderReportActions) {+ if (isOffline || props.isLoadingOlderReportActions) {
return;
}
// Don't load more chats if we're already at the beginning of the chat history
- const oldestReportAction = _.last(props.reportActions);- if (oldestReportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) {+ if (isFetchedTillBeginning) {
return;
}
// Retrieve the next REPORT.ACTIONS.LIMIT sized page of comments
+ const oldestReportAction = _.last(props.reportActions);
Report.getOlderActions(reportID, oldestReportAction.reportActionID);
};
Third, show the loader if either the actions are being loaded via API, or we are offline and should load the actions:
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.7-4 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-12. 🎊
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
Contributor that fixed the issue
Contributor+ that helped on the issue and/or PR
For reference, here are some details about the assignees on this issue:
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:
[@getusha] 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
[@getusha] Determine if we should create a regression test for this bug.
[@getusha] 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.
[@joekaufmanexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: N/A
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
Determine if we should create a regression test for this bug. No, this is a minor visual issue which will not affect any user flow.
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.
Activity
melvin-bot commentedon Oct 27, 2023
Triggered auto assignment to @joekaufmanexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Oct 27, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)[-]Chat - Skeleton placeholder flickers when opening chat with IOU in offline mode[/-][+][$500] Chat - Skeleton placeholder flickers when opening chat with IOU in offline mode[/+]melvin-bot commentedon Oct 27, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01caf37bfdd026bf43
melvin-bot commentedon Oct 27, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @getusha (
External)paultsimura commentedon Oct 27, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Chat: the top skeleton loader flickers when offline
What is the root cause of that problem?
The root cause is that we run into an infinite loop of
Report.getOlderActionsAPI calls here:App/src/pages/home/report/ReportActionsView.js
Lines 151 to 165 in 7e06bd7
When the reproduction steps are met, the API call responds with the following error:
{ "code": 666, "jsonCode": 666, "message": "No report actions returned in Auth response" }This leads to the
isLoadingOlderReportActionsbeing set totrueas a failure data, and theReport.getOlderActionsbeing triggered again, which results in a loop.What changes do you think we should make in order to solve the problem?
First, add the following variable:
Second, we should make the actual API call only if we are online:
const loadOlderChats = () => { // Only fetch more if we are not already fetching so that we don't initiate duplicate requests. - if (props.isLoadingOlderReportActions) { + if (isOffline || props.isLoadingOlderReportActions) { return; } // Don't load more chats if we're already at the beginning of the chat history - const oldestReportAction = _.last(props.reportActions); - if (oldestReportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) { + if (isFetchedTillBeginning) { return; } // Retrieve the next REPORT.ACTIONS.LIMIT sized page of comments + const oldestReportAction = _.last(props.reportActions); Report.getOlderActions(reportID, oldestReportAction.reportActionID); };Third, show the loader if either the actions are being loaded via API, or we are offline and should load the actions:
return ( <> <ReportActionsList report={props.report} onLayout={recordTimeToMeasureItemLayout} sortedReportActions={props.reportActions} mostRecentIOUReportActionID={mostRecentIOUReportActionID} loadOlderChats={loadOlderChats} loadNewerChats={loadNewerChats} isLoadingInitialReportActions={props.isLoadingInitialReportActions} - isLoadingOlderReportActions={props.isLoadingOlderReportActions} + isLoadingOlderReportActions={props.isLoadingOlderReportActions || isOffline && !isFetchedTillBeginning} isLoadingNewerReportActions={props.isLoadingNewerReportActions} policy={props.policy} /> <PopoverReactionList ref={reactionListRef} /> </> );What alternative solutions did you explore? (Optional)
getusha commentedon Oct 27, 2023
@paultsimura do you have any explanation on why this issue is not happening on web but only on native?
paultsimura commentedon Oct 27, 2023
@getusha this happens on the Web as well, it's just more difficult to catch:
loadOlderChatsis called onInvertedFlatList.onEndReached:App/src/pages/home/report/ReportActionsList.js
Line 417 in c9f0620
You need to make the screen on the web really short, so the
onEndReachedis triggered, and you'll see both the flickering and the loop in Network tab:Screen.Recording.2023-10-27.at.17.17.09.mov
Also, I've updated my proposal with some extra details.
getusha commentedon Oct 27, 2023
Thanks @paultsimura! tried applying your solution seems like i have an outdated branch, could you please your branch so i can test it?
32 remaining items
melvin-bot commentedon Dec 5, 2023
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Dec 5, 2023
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.7-4 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-12. 🎊
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.
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Dec 5, 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:
joekaufmanexpensify commentedon Dec 11, 2023
@getusha could you please complete the BZ checklist so we can issue payment tomorrow?
joekaufmanexpensify commentedon Dec 12, 2023
Bumped in Slack
getusha commentedon Dec 12, 2023
BugZero Checklist:
joekaufmanexpensify commentedon Dec 12, 2023
Great, TY! BZ checklist is complete. All set to issue payment.
joekaufmanexpensify commentedon Dec 12, 2023
We need to make the following payments here:
joekaufmanexpensify commentedon Dec 12, 2023
@paultsimura $250 sent and contract ended!
joekaufmanexpensify commentedon Dec 12, 2023
@getusha $250 sent and contract ended!
joekaufmanexpensify commentedon Dec 12, 2023
All set. TY everyone!