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

[$500] Android - Settings - App crashes when changing device font size and then tapping on Profile icon #32515

Closed
1 of 6 tasks
lanitochka17 opened this issue Dec 5, 2023 · 26 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

lanitochka17 commented Dec 5, 2023

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.8-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:

  1. Launch New Expensify app
  2. Background the app
  3. Change the device font size
  4. Return to the app
  5. Tap on the profile icon

Expected Result:

App does not crash

Actual Result:

App crashes

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

Bug6302273_1701804101481.Screen_Recording_20231206_002437_New_Expensify.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01977dd9f154104e64
  • Upwork Job ID: 1732120049690255360
  • Last Price Increase: 2023-12-05
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 5, 2023
Copy link

melvin-bot bot commented Dec 5, 2023

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

@melvin-bot melvin-bot bot changed the title Android - Settings - App crashes when changing device font size and then tapping on Profile icon [$500] Android - Settings - App crashes when changing device font size and then tapping on Profile icon Dec 5, 2023
Copy link

melvin-bot bot commented Dec 5, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01977dd9f154104e64

Copy link

melvin-bot bot commented Dec 5, 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 the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 5, 2023
Copy link

melvin-bot bot commented Dec 5, 2023

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

@bernhardoj
Copy link
Contributor

bernhardoj commented Dec 5, 2023

Proposal

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

After changing the device font size, coming back to the app and open the Setting page, the app crashes.

What is the root cause of that problem?

The crash stack trace shows that the error comes from an undefined root state.

} else if (action.payload.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR && rootState.routes.at(-1)?.name !== NAVIGATORS.RIGHT_MODAL_NAVIGATOR) {
action.type = CONST.NAVIGATION.ACTION_TYPE.PUSH;
}

After we change the font device, it's normal that the app is restarted, but somehow this makes the root state becomes undefined

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

Safely access the root state.

-rootState.routes.at(-1)?.name
+rootState?.routes.at(-1)?.name

Just like we did with getTopmostReportId.

function getTopmostReportId(state: NavigationState | NavigationState<RootStackParamList> | PartialState<NavigationState>): string | undefined {
if (!state) {
return;
}

@allroundexperts
Copy link
Contributor

@bernhardoj's proposal looks good!

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Dec 6, 2023

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

@0xmiros
Copy link
Contributor

0xmiros commented Dec 6, 2023

Seems like this was fixed already

@iwiznia
Copy link
Contributor

iwiznia commented Dec 6, 2023

It was? Where?

@allroundexperts
Copy link
Contributor

I think @situchan fixed it yesterday #32525. But, it seems like he missed to change it in /src/libs/Navigation/Navigation.ts.

@suneox
Copy link
Contributor

suneox commented Dec 6, 2023

Proposal

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

Android - Settings - App crashes when changing device font size and then tapping on Profile icon

What is the root cause of that problem?

App crashed at this line by rootState is undefined

The root cause is after changing the font-size config app will be re-render at NavigationRoot component after re-render navigationRef cannot call resetRoot at this line due to the value of dependency [isSmallScreenWidth, authenticated] doen't change so useEffect not call resetRoot function

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

The func onReady callback at NavigationContainer just only pass to parent
So we will handle setIsReady state on NavigationRoot before calling onReady and then add isReady into dependency of useEffect to resetRoot

    ....
    const {isSmallScreenWidth} = useWindowDimensions();
+   const [isReady, setIsReady] = useState(false);
    ....

    useEffect(() => {
        if (!navigationRef.isReady() || !authenticated) {
            return;
        }
        // We need to force state rehydration so the CustomRouter can add the CentralPaneNavigator route if necessary.
        navigationRef.resetRoot(navigationRef.getRootState());
+   }, [isSmallScreenWidth, authenticated, isReady]);


    ....
      <NavigationContainer
      onStateChange={handleStateChange}
+     onReady={() => {
+         setIsReady(true);
+         onReady()
+     }}

Then when Navigation call linkTo we can get rootState of navigation instead of undefined

What alternative solutions did you explore? (Optional)

@situchan
Copy link
Contributor

situchan commented Dec 6, 2023

Ah, so the crash really happened on production app?

@situchan
Copy link
Contributor

situchan commented Dec 6, 2023

My fix was not fixing the root cause, but just to avoid crash. As seen in typing, rootState is not optional so should not be undefined

@situchan
Copy link
Contributor

situchan commented Dec 6, 2023

But, it seems like he missed to change it in /src/libs/Navigation/Navigation.ts.

It's redundant. cc: @blazejkustra

Are you still able to reproduce crash on latest main?

@iwiznia
Copy link
Contributor

iwiznia commented Dec 6, 2023

I think @situchan fixed it yesterday #32525. But, it seems like he missed to change it in /src/libs/Navigation/Navigation.ts.

Ah ok, given it's the same error, I think @situchan should fix it as part of that other issue, agree?

@allroundexperts
Copy link
Contributor

Are you still able to reproduce crash on latest main?

Seems to be fixed on the latest main. I can also no longer reproduce this today. @suneox I see you had posted a proposal recently. Can you reproduce it?

@suneox
Copy link
Contributor

suneox commented Dec 11, 2023

@allroundexperts

Currently it not happens on latest main but the root cause doesn't resolve.

My fix was not fixing the root cause, but just to avoid crash. As seen in typing, rootState is not optional so should not be undefined

My proposal can be resolve the root cause

@melvin-bot melvin-bot bot added the Overdue label Dec 13, 2023
Copy link

melvin-bot bot commented Dec 14, 2023

@iwiznia, @allroundexperts, @bfitzexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@iwiznia
Copy link
Contributor

iwiznia commented Dec 14, 2023

@allroundexperts do you agree we should make the fix @suneox proposes?

@melvin-bot melvin-bot bot removed the Overdue label Dec 14, 2023
@bfitzexpensify
Copy link
Contributor

Bump @allroundexperts - do you think the fix suggested by @suneox is worthwhile, even though this particular bug is no longer happening?

@situchan
Copy link
Contributor

I think we can close this as no longer crash happening. If any critical issue happens in the future with the same root cause, we can always reopen.

@suneox
Copy link
Contributor

suneox commented Dec 17, 2023

Let me check another places same with this issue I'll feedback on tomorrow

Copy link

melvin-bot bot commented Dec 19, 2023

@iwiznia @allroundexperts @bfitzexpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@bfitzexpensify
Copy link
Contributor

Any updated thoughts @suneox?

@suneox
Copy link
Contributor

suneox commented Dec 20, 2023

Any updated thoughts @suneox?

I have tested and could not found any issue related with the root cause for this issue

@bfitzexpensify
Copy link
Contributor

Thanks @suneox. OK, let's close this one out then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

8 participants