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

Refreshing in dev mode causes screen registration duplication (leak) #144

Open
dlindahl opened this issue Aug 29, 2017 · 0 comments
Open

Comments

@dlindahl
Copy link

I don't have a firm grasp on exactly what is going on here, but each time I refresh the app in the iOS simulator using CMD-R, my render path callstack gets more and more complicated where certain screens are being initialized multiple times.

Here is a screen grab showing the difference between a fresh app load vs. two subsequent refreshes without changing any code or state:

Fresh start:
screen shot 2017-08-29 at 4 43 55 pm
Refresh 1
screen shot 2017-08-29 at 4 45 02 pm
Refresh 2
screen shot 2017-08-29 at 4 49 43 pm

The callstack is getting so cumbersome that I had to reduce the font size just to get the entire screen captured.

Of particular worry are the fact that the constructors for HomeScreen and ActivityScreen are getting called more and more between each refresh. There should only be one instance of each of those screens. One of them is using react-refetch which means that each time those multiple instances are mounted, one network request is sent to my backend. That means that each refresh of the app adds more and more network requests until I get to the point where I'm slamming my dev server with multiple requests just to render a single screen 😱

If I had to guess, I'd say this could be related to #128 in that the previous navigation stack still exists and is being executed along with the new stack.

The "work around" is to stop the program in XCode and restart it. While this works, technically speaking, it obviously removes a nice feature of using React Native in the first place.

If it helps, I'm also using the Redux integration documented at http://airbnb.io/native-navigation/docs/guides/project-structure.html#integrating-with-redux

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

No branches or pull requests

1 participant