meteor-animation-helper-velocity
meteor-animation-helper-velocity copied to clipboard
Exception in queued task: Error: Can't set timers inside simulations
I'm getting this error each time an item is removed. Error points to:
Template['AnimateWithVelocity'].destroyed = function(){
var template = this;
Meteor.defer(function(){
template._animation_helper_parentNode._uihooks = null;
});
};
Any idea on why this happens?
Could you show me the error you get?
Hmm, just updated and works well. I was having some problems with other packages so maybe this is related.
Hi @frozeman,
I'm still getting this error due to Defer. Any idea on how can we fix it?
Here's the log:
at withoutInvocation (http://myapp.com/packages/meteor.js?ba96dc1f04ac6e63264a9aea0915717a5e52c365:406:13)
at bindAndCatch (http://myapp.com/packages/meteor.js?ba96dc1f04ac6e63264a9aea0915717a5e52c365:414:33)
at Object._.extend.setTimeout (http://myapp.com/packages/meteor.js?ba96dc1f04ac6e63264a9aea0915717a5e52c365:430:23)
at Template.AnimateWithVelocity.destroyed (http://myapp.com/packages/mrt:animation-helper-velocity.js?35557fff7424296f1ca52da7da6c2917b5333730:160:12)
at null.<anonymous> (http://myapp.com/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:2813:22)
at fireCallbacks (http://myapp.com/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:1814:16)
at Object.Tracker.nonreactive (http://myapp.com/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:502:12)
at http://myapp.com/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:1811:13
at Object.Blaze._withCurrentView (http://myapp.com/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:2017:12)
at Object.Blaze._fireCallbacks (http://myapp.com/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:1810:9)
Ca you update to 0.1.4 an try if its fixed?
I've updated to 0.1.3 and get the same error :(
The error is:
Exception in queued task: Error: Can't set timers inside simulations
could you add the full error log, as well as the line its talking about (clicking on the line where it says Template...destroy: ....)
Here's the full error log:
Exception in queued task: Error: Can't set timers inside simulations
at withoutInvocation (http://myapp.com/packages/meteor.js?ba96dc1f04ac6e63264a9aea0915717a5e52c365:406:13)
at bindAndCatch (http://myapp.com/packages/meteor.js?ba96dc1f04ac6e63264a9aea0915717a5e52c365:414:33)
at Object._.extend.defer (http://myapp.com/packages/meteor.js?ba96dc1f04ac6e63264a9aea0915717a5e52c365:469:26)
at Template.AnimateWithVelocity.destroyed (http://myapp.com/packages/mrt:animation-helper-velocity.js?784db8e6c73cbb7d9f83628227a4d77049350dbf:160:12)
at null.<anonymous> (http://myapp.com/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:2813:22)
at fireCallbacks (http://myapp.com/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:1814:16)
at Object.Tracker.nonreactive (http://myapp.com/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:502:12)
at http://myapp.com/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:1811:13
at Object.Blaze._withCurrentView (http://myapp.com/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:2017:12)
at Object.Blaze._fireCallbacks (http://myapp.com/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:1810:9)
And it points to line 160:
Meteor.defer(function() {
I only found this here: https://groups.google.com/forum/#!msg/meteor-talk/_ZD07b68TMg/2lBX9YWiEDsJ
I talks about this error in the context of methods. Do you used any methods?
I think that using Meteor.setTimeout instead of defer would solve it. I'm not using it inside methods, I hide or show elements based on helpers and when removed it fires the error.
The erro appeared also with the setTimeout before. Meteor.defer is valid on the client and server is actually the same as setTimeout
I'm not doing anything special, no custom code, just the animation helper firing when an element is removed and it's called on client, no server.
The element removed has a custom template, it's part of an #each helper.
im also "ratlos" here :)
Back from holidays :)
Maybe we add a !Meteor.isSimulation check before running the code? Not sure why meteor things this is a simulation,
Meteor.isSimulation doesn't exist :) i never got this error, in which circumstance do you get it?
Do you have your templates, also on the server? as i host mine mostly in the client folder
Ups XD
It's !this.isSimulation and it's only for methods :)
I don't have templates on server, is all client files. I'm trying to get more info from the error but not sure how to work with local packages in meteor package system.
Ok, using defer an setTimeout causes the same problem. Removing it causes:
Uncaught Error: Must be attached
I get the same error with different kind of template structures, but always inside an #each loop:
- Just #each loop
- Loop with nested #if in each element (both hide at the same time as element is removed)
I've removed all the destroyed callback, it fires the Must be attached error but works as expected (Tested on chrome)
The problem is that without the delay, it can't remove the unhooks properly, which can cause to much later animations, which were not intended, i guess.
And you can't get this error on any on your apps? Maybe it's a problem caused by another package? Some kind of conflict?
no, but i never really used in inside a each loop :)
I've added a log and now I see some interesting things.
In the case I'm testing I've an #each loop an on each element I've another #if that show/hides a template.
- Error occurs only when removing parent element
- That element calls the destroyed before the child #if element
- The #if element doesn't throws any error
So the error steps are:
- Destroyed for parent element is called
- Defer throws the simulation error
- Destroyed is called on the child element
- Defer is completed as expected
The problem seems to be in #each loop.
Removing parent or child animation still causes the same problem, so I can say now that the problem is with #each loops and I don't have any idea on how to fix it.
Do you have any idea on why this fails with #each loops @frozeman ?
alright. so we basically want to remove the ui_hook from a parent element, which is not in the DOM anymore.
Add the package from github to you packages folder, it then uses the one in the folder and you can edit it.
i made some changes to the parentNode, can you check if that fixes it?
I already have the code on a local copy to change and test. I've replaced my code with last version and still get the same error about simulations :(
Anything I can check? When the destroyed method is called I can log the template to console and all seems ok.
Thanks ;)
Ups, sorry, forgot to comment the defer (copied old code).
Now the error is:
Uncaught Error: Must be attached domrange.js:337DOMRange.containsElement
domrange.js:337(anonymous function) view.js:741(anonymous function)
events.js:47jQuery.event.dispatch jquery.js:4624jQuery.event.add.elemData.handle
i made a small change can you try again?
Tested with last version, same Must be attached error. Is there any thing I can log to help you?
it has to do with the fact that the DOM elements are not in the DOM anymore when the destroyed method is called. additionally the parent gets removed before the child.
I don't know any solution yet, you can try playing around with the parentNode, maybe log the first node and the firstNode.parentnode and see what it gives you (in the destroyed callback)
Ok, this is the log:
When destroyed is called for the #each loop element firstNode is an empty string with some spaces and parentNode is the div that should be removed.
For the child element firstNode is #text node, not sure what it's exactly. parentNode is the div that is removed.
BTW, element is never removed from the html, it throws the error and the html is never removed from the dom.