-
Notifications
You must be signed in to change notification settings - Fork 52
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
Will the application-wide LocalState variable impact the performance of an app when we are setting up more and more reactive LocalState? #169
Comments
Can you specify a little more? |
I watch for changes of LocalState keys whenever the route is changed When navigate to route A, there're 10 keys in LocalState, then navigate to route B, there will be 20 keys in LocalState. The LocalState keys were not destroyed after switching routes. |
This seems more like a problem with how you're managing your functions. |
Checkout this repo cloned from mantra sample app You will see it in console, As our app grows, there'll be a lot of reactive states, and we really only need the ones that are related to the current page. I can reset the The way Mantra uses Correct me if I'm saying something wrong. |
LocalState.key just gives you data that is internally stored inside reactiveDict. True that the keys cannot be deleted after initialization. And i understand that it may seem sort of ugly. But they has no performance influence on application. The reactive dependencies to this internal data DOES. When Tracker meets some TheReactiveVar.set() it looks throuh list of dependencies (array of functions that are passed to Tracker.autorun() and have TheReactiveVar.set() inside their bodies). But, as fermuch said, "when the container is destroyed (when you switch routes), all the dependencies tracker generated are also destroyed". |
The states were not destroyed when switching between different routes, although we can set it to null when unmounting, but it would still watching for changes in LocalState even we don't really need it.
Is there anyway we can destroy the states once it's not been used anymore?
The text was updated successfully, but these errors were encountered: