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

Any reason to use library instead of this code snippet? #6

Closed
xlc opened this issue Aug 22, 2017 · 1 comment
Closed

Any reason to use library instead of this code snippet? #6

xlc opened this issue Aug 22, 2017 · 1 comment

Comments

@xlc
Copy link

xlc commented Aug 22, 2017

This will run all the watchers inside autorun and track all the dependencies, without using internal angular variables

mobx.autorunAsync('$rootScope#$digst', () => {
    $rootScope.$digest();
}, 2);

Please let me know if I missed anything

@adamkleingit
Copy link
Member

Yes,
You code will run digest on the entire scope tree instead of just the components that need to be updated. Your app will pretty much be unusable if it gets bigger.
Also, if you're already in a digest cycle this will cause an error

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

2 participants