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] IOU - Request details page loads infinitely when request is created offline #37247
Version Number: 1.4.44-0 Reproducible in staging?: Y Reproducible in production?: N 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:
Go to staging.new.expensify.com
Go offline
Go to workspace chat
Create a manua; request
Navigate to request details page
Expected Result:
The request details page will load when the request is created offline (production behavior)
Actual Result:
The request details page loads infinitely when the request is created offline (production behavior).
This issue also occurs when:
creating IOU with new user offline. The main chat loads infinitely.
Same issue when opening thread offline
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
changed the title [-] IOU - Request details page loads infinitely when request is created offline[/-][+][$500] IOU - Request details page loads infinitely when request is created offline[/+]on Feb 27, 2024
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Please re-state the problem that we are trying to solve in this issue.
The request details page loads infinitely when the request is created offline (production behavior).
This issue also occurs when:
What is the root cause of that problem?
This is regression of this PR Expensify/react-native-onyx#470 since we always set value to mapping.initialValue without the check mapping.initialValue is undefined or not
And then we have allowStaleData as true for report key here which makes cachedState wrong and then report data in Onyx is wrong.
Okay, it's indeed reproducible after the Onyx version bump, but here is the real root cause.
What the recent Onyx PR does is to immediately render the report screen by fixing some initialValue that are not applied when they are falsey (false or null). Btw, this PR is the first one that attempted to immediately render the report screen, but because we have the Onyx bug, it's not solved 100%.
Now, when we press the money request preview, we create an optimistic transaction thread and navigate to it.
So, the optimistic transaction thread is overwritten with the report above that only contains reportName, thus the infinite loading.
How do we solve this?
I would remove the logic to change the onyx method to SET (in point 2). It was added in this PR to solve #19364. The issue is that the not-found view is shown briefly (instead of skeleton loading) when opening a thread.
If we read the root cause from the proposal, it's because when we don't have the report data yet, the default props of the report will have a value of isLoadingReportActions as false which makes the not found condition becomes true.
Instead of using SET, we should just set the default value of isLoadingReportActions to true which is already the case today. isLoadingReportActions is isLoadingInitialReportActions in the latest code.
Hey, @bernhardoj just a note: a part of the root cause is that the money report actions have no childReportID when created offline – this is being fixed in #37232
Activity
[-] IOU - Request details page loads infinitely when request is created offline[/-][+][$500] IOU - Request details page loads infinitely when request is created offline[/+]melvin-bot commentedon Feb 27, 2024
Job added to Upwork: https://www.upwork.com/jobs/~0106a1c5479d6e9daa
melvin-bot commentedon Feb 27, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ishpaul777 (
External)github-actions commentedon Feb 27, 2024
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
melvin-bot commentedon Feb 27, 2024
Auto-assign attempt failed, all eligible assignees are OOO.
lanitochka17 commentedon Feb 27, 2024
We think that this bug might be related to #vip-bills
CC @davidcardoza
dukenv0307 commentedon Feb 27, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
The request details page loads infinitely when the request is created offline (production behavior).
This issue also occurs when:
What is the root cause of that problem?
This is regression of this PR Expensify/react-native-onyx#470 since we always set
valuetomapping.initialValuewithout the checkmapping.initialValueis undefined or notAnd then we have
allowStaleDataastrueforreportkey here which makescachedStatewrong and thenreportdata in Onyx is wrong.App/src/pages/home/ReportScreen.js
Line 617 in d2a9c6f
What changes do you think we should make in order to solve the problem?
We should add the check
mapping.initialValue !== undefinedhere https://github.com/Expensify/react-native-onyx/blob/c9f22a3f655eb14b1cce7b98282fe21646c5d27d/lib/withOnyx.js#L62What alternative solutions did you explore? (Optional)
We can remove
allowStaleDatahere and thencachedStatewill be calculated correctlyApp/src/pages/home/ReportScreen.js
Line 617 in d2a9c6f
melvin-bot commentedon Feb 27, 2024
youssef-lr commentedon Feb 27, 2024
cc @bernhardoj I think this is related to your PRs here & here
bernhardoj commentedon Feb 27, 2024
Checking
bernhardoj commentedon Feb 27, 2024
Okay, it's indeed reproducible after the Onyx version bump, but here is the real root cause.
What the recent Onyx PR does is to immediately render the report screen by fixing some
initialValuethat are not applied when they are falsey (false or null). Btw, this PR is the first one that attempted to immediately render the report screen, but because we have the Onyx bug, it's not solved 100%.App/src/components/ReportActionItem/MoneyRequestAction.tsx
Lines 96 to 101 in d2a9c6f
Because the report screen is now immediately rendered, the new report Onyx data is not available yet, so the code below will call
openReport.App/src/pages/home/ReportScreen.js
Lines 355 to 362 in d2a9c6f
openReport, we have a logic to use SET method (for the optimistic report) when the report is not in the Onyx yet,App/src/libs/actions/Report.ts
Lines 608 to 613 in d2a9c6f
The optimistic report looks like this
App/src/libs/actions/Report.ts
Lines 552 to 556 in d2a9c6f
So, the optimistic transaction thread is overwritten with the report above that only contains
reportName, thus the infinite loading.How do we solve this?
I would remove the logic to change the onyx method to SET (in point 2). It was added in this PR to solve #19364. The issue is that the not-found view is shown briefly (instead of skeleton loading) when opening a thread.
If we read the root cause from the proposal, it's because when we don't have the report data yet, the default props of the report will have a value of
isLoadingReportActionsasfalsewhich makes the not found condition becomes true.App/src/pages/home/ReportScreen.js
Lines 97 to 100 in 2157057
App/src/pages/home/ReportScreen.js
Lines 266 to 267 in 2157057
isLoadingReportActionswill becometruewhen theopenReportoptimistic data is merged.App/src/libs/actions/Report.js
Lines 334 to 339 in 2157057
Instead of using SET, we should just set the default value of
isLoadingReportActionsto true which is already the case today.isLoadingReportActionsisisLoadingInitialReportActionsin the latest code.App/src/pages/home/ReportScreen.js
Lines 620 to 623 in d2a9c6f
App/src/pages/home/ReportScreen.js
Lines 495 to 501 in d2a9c6f
@youssef-lr should the solution be reviewed first or should I just immediately create the follow-up PR to fix this?
melvin-bot commentedon Feb 27, 2024
youssef-lr commentedon Feb 27, 2024
You can start on the PR, thanks!
paultsimura commentedon Feb 27, 2024
Hey, @bernhardoj just a note: a part of the root cause is that the money report actions have no
childReportIDwhen created offline – this is being fixed in #37232bernhardoj commentedon Feb 27, 2024
@paultsimura thanks, yep I noticed about that too, but not really sure whether it's intentional or not.
Here is the PR to fix this issue #37269
puneetlath commentedon Feb 27, 2024
Looks like this revert fixed it. Closing, but feel free to reopen if I'm mistaken.