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

this.getReactively not triggering autorun #1577

Closed
sebakerckhof opened this issue Mar 2, 2017 · 0 comments
Closed

this.getReactively not triggering autorun #1577

sebakerckhof opened this issue Mar 2, 2017 · 0 comments

Comments

@sebakerckhof
Copy link
Contributor

I have a variable that updates and is being called inside an autorun function.
If I watch the variable with $scope.$watch I see it changes. However, it's not triggering the autorun function.

Example reproduction:
https://github.com/sebakerckhof/ngmeteor-bug

If you run the application, you'll see a list. Clicking on the list updates an element in minimongo, which in turns changes a variable. The variable is passed to another component, which should trigger an update, but it doesn't.

E.g. this line is being called: https://github.com/sebakerckhof/ngmeteor-bug/blob/master/imports/ui/foo-details/foo-details.component.js#L18

But not this one: https://github.com/sebakerckhof/ngmeteor-bug/blob/master/imports/ui/foo-details/foo-details.component.js#L23

I know I could probably create the application in a different way, but this is a minimal reproduction of a more complex scenario where this flow is justified.

ping @Urigo

@sebakerckhof sebakerckhof changed the title this.getReactively not working while variable changes this.getReactively not triggering autorun Mar 2, 2017
sebakerckhof added a commit to sebakerckhof/angular-meteor that referenced this issue Apr 18, 2017
sebakerckhof added a commit to sebakerckhof/angular-meteor that referenced this issue Apr 18, 2017
sebakerckhof added a commit to sebakerckhof/angular-meteor that referenced this issue Apr 20, 2017
It's possible that a digest loop from one autorun function, triggers another autorun function to be ran. Before this commit, the second autorun thought it was nested in the first autorun. This has as a side effect that when the first autorun re-runs, it will stop the second autorun from running. This commit runs the digest in a non-reactive manner, which means it temporarily resets the current active tracker computation. Therefore no parent-child relation is created between the 2 autorun functions, solving this problem.
sebakerckhof added a commit to sebakerckhof/angular-meteor that referenced this issue Apr 20, 2017
It's possible that a digest loop from one autorun function, triggers another autorun function to be ran. Before this commit, the second autorun thought it was nested in the first autorun. This has as a side effect that when the first autorun re-runs, it will stop the second autorun from running. This commit runs the digest in a non-reactive manner, which means it temporarily resets the current active tracker computation. Therefore no parent-child relation is created between the 2 autorun functions, solving this problem.
sebakerckhof added a commit to sebakerckhof/angular-meteor that referenced this issue Apr 20, 2017
It's possible that a digest loop from one autorun function, triggers another autorun function to be ran. Before this commit, the second autorun thought it was nested in the first autorun. This has as a side effect that when the first autorun re-runs, it will stop the second autorun from running. This commit runs the digest in a non-reactive manner, which means it temporarily resets the current active tracker computation. Therefore no parent-child relation is created between the 2 autorun functions, solving this problem.
Urigo added a commit that referenced this issue Apr 20, 2017
@Urigo Urigo closed this as completed Oct 31, 2017
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