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

Updated react-navigation and related packages #841

Merged
merged 1 commit into from
Jul 22, 2020

Conversation

arrygoo
Copy link

@arrygoo arrygoo commented Jul 22, 2020

Most of this is described in the issue: #445

Issue:
Currently, there's a scenario where the app shows a warning regarding a memory leak, caused by setstate being called on an unmounted component.

Reproduction steps:

  • Either do a fresh install of the app, or Clear Cache and Clear Storage
  • Open the app and finish onboarding
  • Press the android "back" button to close the app
  • Reopen the app, and see the warning
  • After this PR, the warning doesn't show up anymore

Solution:
After further inspection, I don't believe there's anything in our app code that's causing the problem. The problem seems to come from a setTimeout in react-navigation that happens when the app comes from background to foreground. This problem was described here:
react-navigation/react-navigation#8226
And solved in a recent version of react-navigation:
react-navigation/react-navigation@0149e85

I tried updating @react-navigation/stack only, but that didn't fix the warning. However, updating all related @react-navigation packages seems to fix the warning completely.

Notes:
Interesting to note that the react-navigation fix, in my opinion, is an anti-pattern as described here: https://reactjs.org/blog/2015/12/16/ismounted-antipattern.html
But oh well, it's in their own package, and I'm sure a lot of smart people are working on that package so maybe this instance is acceptable.

@arrygoo arrygoo requested a review from a team as a code owner July 22, 2020 16:53
@timarney timarney merged commit 217318a into cds-snc:master Jul 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants