Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

MOB-M-9: REACT state update on an unmounted component #445

Closed
obrien-j opened this issue Jul 5, 2020 · 4 comments
Closed

MOB-M-9: REACT state update on an unmounted component #445

obrien-j opened this issue Jul 5, 2020 · 4 comments

Comments

@obrien-j
Copy link

obrien-j commented Jul 5, 2020

Performance Summary
When reviewing code in ../covid-shield- mobile/blob/add_device_capabilities/src/screens/home/HomeScreen.tsx#L58, the following suggestion was made

Unmounted component warning that points to a potential memory leak concern.

Analysis of the Issue
There is a warning when app is running in debug mode (at least in Android) that says there is a REACT state update on an unmounted component pointing to the Container component, indicating a memory leak.

image

Recommendation
Recommend to look into the useEffects() call to provide fix to address the memory leak issue.

@jeberhardt
Copy link
Contributor

I looked into this quite a bit yesterday, and was unable to determine exactly which component was unmounted and trying to update the state.

To replicate on Android:

  • Launch the app, running in debug mode (ie: not an app from TestFlight or the Play Store)
  • Navigate through the app to go to a few screens
  • Press the system back button until the app exits
  • Press the icon to launch the app again
  • A warning may appear at the bottom of the screen (YellowBox).

The warning doesn't happen every time, maybe only 50% of the time.

@henrytao-me
Copy link
Contributor

@react-native-community/netinfo is the one causing the leak. Ref https://github.com/CovidShield/mobile/pull/139/files#diff-bb2a692e69dc457e8a5d5757bdaf9a3bR55

@jeberhardt
Copy link
Contributor

Even with the updated netinfo package, this problem still persists. Same steps as above to replicate.

@henrytao-me
Copy link
Contributor

Close as fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants