Getting [$rootScope:inprog] $digest already in progress [SANITIZED URL] in Meteor app using meteor-angular-templates

141 Views Asked by At

Getting [$rootScope:inprog] $digest already in progress [SANITIZED URL] in Meteor app using meteor-angular-templates

I have been getting this error is some places in my meteor app. I tried wrapping $apply calls in my app within a $timeout but that didn't work. I suspect it has something to do with Tracker.autorun() calls in my angular controllers. Does Tracker.autorun() follow the same digest and apply cycle as Angular? Is multiple function calls a reason that the view pages are being rendered again and again which cause $digest error.

Tracker.autorun(() => {
    Multiple function calls here
})

logDNA screenshot

1

There are 1 best solutions below

1
georgeawg On

From the Docs:

Error: $rootScope:inprog Action Already In Progress

Diagnosing This Error

When you get this error it can be rather daunting to diagnose the cause of the issue. The best course of action is to investigate the stack trace from the error. You need to look for places where $apply or $digest have been called and find the context in which this occurred.

There should be two calls:

  • The first call is the good $apply/$digest and would normally be triggered by some event near the top of the call stack.

  • The second call is the bad $apply/$digest and this is the one to investigate.

Once you have identified this call you work your way up the stack to see what the problem is.

  • If the second call was made in your application code then you should look at why this code has been called from within an $apply/$digest. It may be a simple oversight or maybe it fits with the sync/async scenario described earlier.

  • If the second call was made inside an AngularJS directive then it is likely that it matches the second programmatic event trigger scenario described earlier. In this case you may need to look further up the tree to what triggered the event in the first place.

For more information, see