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

[HOLD for payment 2023-10-16] [$500] Report screen becomes empty when resizing to big size from LHN #28354

Closed
1 of 6 tasks
kavimuru opened this issue Sep 27, 2023 · 25 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Sep 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!


Action Performed:

  1. Resize the app to small width.
  2. Navigate to LHN.
  3. Resize again to larger width

Expected Result:

The report screen should be present on the right

Actual Result:

There is no report screen on the right.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.74-2
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
Notes/Photos/Videos: Any additional supporting documentation

20230927_201827.mp4
Screen.Recording.2023-09-25.at.11.30.00.PM.1.mov

Expensify/Expensify Issue URL:
Issue reported by: @esh-g
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1695664942781769
View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0117356277518975bf
  • Upwork Job ID: 1707142377110151168
  • Last Price Increase: 2023-09-27
  • Automatic offers:
    • tienifr | Contributor | 26975213
    • esh-g | Reporter | 26975214
@kavimuru kavimuru added External Added to denote the issue can be worked on by a contributor Daily KSv2 labels Sep 27, 2023
@melvin-bot melvin-bot bot changed the title Report screen becomes empty when resizing to big size from LHN [$500] Report screen becomes empty when resizing to big size from LHN Sep 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 27, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0117356277518975bf

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 27, 2023

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

@allroundexperts
Copy link
Contributor

Proposal

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

Report screen becomes empty when resizing to big size from small size while on LHN.

What is the root cause of that problem?

The root cause of the issue is that getRehydratedState function here gets executed before the ResponsiveStackNavigator component re-renders. This causes the value of ref of the isSmallScreenWidth to always lag one render behind. Thus, the condition here does not execute correctly.

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

Instead of passing in a getIsSmallScreenWidth function here, we should replace this with the following:

const isSmallScreen = Dimensions.get('screen').width <= variables.extraSmallMobileResponsiveHeightBreakpoint;
            // Make sure that there is at least one CentralPaneNavigator (ReportScreen by default) in the state if this is a wide layout
            if (!isAtLeastOneCentralPaneNavigatorInState(partialState) && !isSmallScreen) {

What alternative solutions did you explore? (Optional)

None

@tsa321
Copy link
Contributor

tsa321 commented Sep 28, 2023

Cannot reproduce in version v1.3.72-5.

@tienifr
Copy link
Contributor

tienifr commented Sep 28, 2023

Proposal

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

There is no report screen on the right.

What is the root cause of that problem?

We're using debounce for the window dimensions in withWindowDimensions here. This leads to the isSmallScreenWidth of withWindowDimensions being updated 300ms after the window dimensions change (for performance reasons), which is after the getRehydratedState here is called, causing getRehydratedState to get the stale value of isSmallScreenWidth and renders incorrectly.

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

Since we want to retrieve the latest value of isSmallScreenWidth in getRehydratedState, we should use the useWindowDimensions which is an one-off hook that provides the same correct isSmallScreenWidth value.

  1. Replace this line with
const {isSmallScreenWidth} = useWindowDimensions();

const isSmallScreenWidthRef = useRef(isSmallScreenWidth);

isSmallScreenWidthRef.current = isSmallScreenWidth;
  1. And remove this line

What alternative solutions did you explore? (Optional)

We can calculate the isSmallScreenWidth again in the getRehydratedState using Dimensions, but this unnecessarily duplicates the calculation logic, so I prefer to reuse the hook that we already have.

@narefyev91
Copy link
Contributor

Proposal from @tienifr looks good to me #28354 (comment)
To be sure that rehydrate state will be up-to-date we should use direct hook for getting isSmallScreenWidth
🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Sep 28, 2023

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

@allroundexperts
Copy link
Contributor

@narefyev91 Are you sure we want to go via this route?

We might want to debounce useWindowDimensions as well in the future for performance reasons. Doing so will re-introduce this bug. Adding the small screen check directly here as shown in my proposal is a more fail proof solution.

Also, the above approach has an added advantage in the sense that ResponsiveStackNavigator would get rid of the screen size dependency (and the ref + extra renders which comes with it) altogether.

@arosiclair Would be awesome to get your opinion as well before we proceed.

@narefyev91
Copy link
Contributor

@allroundexperts Hey! debounce was added only for one particular case - to prevent crash during fast resizing and remove loading indicator #26071 - and i think that fix was a hack. Using debounce in useEffect may lead to unpredictable results - like even fetching not correct size. BTW now we planning to move away from HOC withWindowDimensions - and we can use direct hook without listening for changes in useEffect inside HOC.
Also i checked solution from @tienifr for current issue and for issue with resizing image:

8mb.video-Bx1-WZ2rWPv6.mp4

On the other hand - @allroundexperts solution is working but breaking go back logic

Screen.Recording.2023-09-29.at.10.20.52.mov

Current issue is a regression from adding debounce to track resize changes - and using direct size from useWindowDimensions is a correct workflow.

cc @arosiclair

@allroundexperts
Copy link
Contributor

Thanks for the detailed response @narefyev91. That's a nice catch. Let's go with @tienifr's solution!

@melvin-bot melvin-bot bot added Overdue and removed Help Wanted Apply this label when an issue is open to proposals by contributors labels Oct 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

📣 @esh-g 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

@arosiclair, @narefyev91, @tienifr Whoops! This issue is 2 days overdue. Let's get this updated quick!

@arosiclair
Copy link
Contributor

Not sure why Bug was not applied and we went straight to External

@melvin-bot melvin-bot bot removed the Overdue label Oct 2, 2023
@arosiclair arosiclair added the Bug Something is broken. Auto assigns a BugZero manager. label Oct 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

Triggered auto assignment to @zanyrenney (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 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

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Oct 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 5, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @tienifr got assigned: 2023-10-02 07:58:37 Z
  • when the PR got merged: 2023-10-05 08:21:47 UTC
  • days elapsed: 3

On to the next one 🚀

@tienifr
Copy link
Contributor

tienifr commented Oct 6, 2023

@arosiclair Is it eligible for 50% bonus because I and @narefyev91 finished work very early?

@arosiclair
Copy link
Contributor

@arosiclair Is it eligible for 50% bonus because I and @narefyev91 finished work very early?

I think we usually count any time for review so probably no but I'm not sure really. @zanyrenney ^

@jasperhuangg
Copy link
Contributor

This issue is still present on Web/Desktop on staging, @tienifr please look into this.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 9, 2023
@melvin-bot melvin-bot bot changed the title [$500] Report screen becomes empty when resizing to big size from LHN [HOLD for payment 2023-10-16] [$500] Report screen becomes empty when resizing to big size from LHN Oct 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.79-5 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-10-16. 🎊

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:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 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:

  • [@narefyev91] The PR that introduced the bug has been identified. Link to the PR:
  • [@narefyev91] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@narefyev91] 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:
  • [@narefyev91] Determine if we should create a regression test for this bug.
  • [@narefyev91] 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.
  • [@zanyrenney] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 Daily KSv2 labels Oct 16, 2023
@zanyrenney
Copy link
Contributor

zanyrenney commented Oct 16, 2023

@arosiclair @tienifr #28354 (comment) based on this comment, it is not eligible for the urgency bonus.

the pull request did not get merged within 3 working days of assignment

@zanyrenney
Copy link
Contributor

payment summary

@narefyev91 does not require payment (Contractor)
@tienifr requires payment offer (Contributor) - paid $500
@esh-g requires payment offer (Reporter) paid $50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants