Repository navigation
Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.4.0.3
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: @shubham1206agra
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1700236291136659
Action Performed:
(watch the vid before you try to reproduce, it'll be more clear)
- Open any report in full size
- Go to small screen view
- Press back header
- Go to large view (>800) again
Expected Result:
All the messages should be loading
Actual Result:
Report becomes blank
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
Recording.243.mp4
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~0195fdcb43d1c84e8f
- Upwork Job ID: 1725605698649042944
- Last Price Increase: 2023-11-24
- Automatic offers:
- alitoshmatov | Reviewer | 27909873
- tienifr | Contributor | 27909877
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone

Activity
[-]Report gets blank after resizing[/-][+][$500] Report gets blank after resizing[/+]melvin-bot commentedon Nov 17, 2023
Triggered auto assignment to @mallenexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Nov 17, 2023
Job added to Upwork: https://www.upwork.com/jobs/~0195fdcb43d1c84e8f
melvin-bot commentedon Nov 17, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Nov 17, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @alitoshmatov (
External)mallenexpensify commentedon Nov 17, 2023
Was able to reproduce after watching vid, def something we want t ofix. I feel like a version of this bug has existed before, I couldn't find any GHs for it though.
tienifr commentedon Nov 17, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Report becomes blank
What is the root cause of that problem?
The
getRehydratedStatehere is run before theuseWindowDimensionshook render again, leading to theisSmallScreenWidthis still true whengetRehydratedStateis run while it actually should be false. This causes the Central Pane not to be added when resizing the screen and the report is blank.What changes do you think we should make in order to solve the problem?
In here, calculate the
isSmallScreenWidthby using theDimensions.get('window').widthinsidegetRehydratedStateto get the latest value.The logic is the same as the existing
isSmallScreenWidthcalculation here, just that it uses current value of the window dimension instead of using a hook, and should be used in cases like this theisSmallScreenWidthneeds to be retrieved immediately without delay of a hook render. The logic can be extracted to agetIsSmallScreenWidthmethod for reuse.Then we can clean up the existing
getIsSmallScreenWidthhere in web since it's not used any moreWhat alternative solutions did you explore? (Optional)
NA
barros001 commentedon Nov 17, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
When on a report, and switching screen to the small view (mobile), clicking back on the report (which takes you to LHN), and then switching back to desktop view, central panel will be empty. The same happens if you load the app on mobile view (which will land you on LHN) and expanding the window to desktop size, no central panel will be loaded.
What is the root cause of that problem?
The root problem is is the sequence in which things are rendered. The app is structured this way (very simplified)
When you switch from mobile to desktop (and vice versa), these components would all re-render because they all relay on
isSmallScreenWidth, which comes fromuseWindowDimensionshook. Normally things would happen in the correct sequence, but when switching views, things get out of order. Here's why:App/src/libs/Navigation/NavigationRoot.js
Lines 74 to 80 in 3f7e66a
When
isSmallScreenWidth, this hook gets executed which in turn will callnavigationRef.resetRoot(navigationRef.getRootState());. That will trigger getRehydratedState which will look forisSmallScreenWidth. This all happens before<Navigation>gets a chance to re-render and update the value ofisSmallScreenWidth. For that reasongetRehydratedStatewill have a stale value and it will not add the central panel.What changes do you think we should make in order to solve the problem?
We need to delay calling
navigationRef.resetRoot(navigationRef.getRootState());until everything have been re-rendered. To accomplish that we have two options:useEffectintocreateCustomStackNavigator.js:We can remove the use effect from
NavigatorRootand add tocreateCustomStackNavigatoras follows:That will bring the logic closer to where it affects while making sure it only calls
resetRootwhen we have the correct value forisSmallScreenWidth.resetRoot:Wrapping the call to
resetRootin asetTimeoutwith a 0 delay will just let javascript process everything in the queue first, which means it will let react re-render everything before going back to it. This solves the problem and the central panel is added back.What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
DevWithDerick commentedon Nov 18, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Report becomes blank when switching from desktop to mobile view, pressing back button and then going back to the desktop view
What is the root cause of that problem?
getRehydratedStatefunction inside theCustomRouteris not called immediately after we switch from mobile to desktop (and other way around)What changes do you think we should make in order to solve the problem?
In the
ResponsiveStackNavigator, we should add simpleuseEffectthat is triggered whenisSmallScreenWidthis changed and callnavigation.reset(state);This will manually callgetRehydratedStateevery time we have a transition desktop-mobile or mobile-desktop transition.103 remaining items
shubham1206agra commentedon Jan 31, 2024
@mallenexpensify We reverted the change so its still broken. @alitoshmatov needs to review the proposal here to fix this again. So can you reopen this again?
dangrous commentedon Jan 31, 2024
Yep, you're right, reopening as we reverted the PR that fixed it.
We should determine whether @tienifr and @alitoshmatov should work to fix (again) since they were the original assignees, or whether we want to open it up again.
Thanks!
alitoshmatov commentedon Feb 2, 2024
I am a little bit confused. @shubham1206agra your proposal is exactly the same as @tienifr 's, Are you suggesting that reimplementing this solution is correct approach. If yes, I think I and @tienifr can reimplement this easily since it is the same old solution. I am happy to review it without any payment.
shubham1206agra commentedon Feb 2, 2024
Reimplementing with little changes. But let's wait for Ideal Nav to stabilize to check the repro of the issue.
Edit - Looks like the issue will be fixed. Lets wait for the Ideal Nav to hit production.
alitoshmatov commentedon Feb 2, 2024
@shubham1206agra That looks like a plan, I do agree with holding this issue since this issue is an edge case
[-][HOLD for payment 2024-01-24] [$500] Report gets blank after resizing[/-][+][$500] Report gets blank after resizing[/+]mallenexpensify commentedon Feb 13, 2024
Posted in the Wave 8 room. to check
mallenexpensify commentedon Feb 14, 2024
I'm going to close this. Coming from the internal slack discussion
If/when we want to address resizing we'll be able to easily find this issue cuz
resizingis in the title.