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

Error: TypeError: Cannot read property 'destroy' of undefined #7

Closed
MichelFloyd opened this issue May 29, 2015 · 4 comments
Closed

Comments

@MichelFloyd
Copy link
Contributor

I installed chronos in my app yesterday at Rahul's recommendation at the Meteor DevShop. Things seemed to be looking good (my pages were reacting to time passing) but then a bunch of things broke and I noticed this in inspector:

Error: TypeError: Cannot read property 'destroy' of undefined
at http://localhost:3000/packages/remcoder_chronos.js?9d17e85fb95f3419f5249be9494ebe37472d7d67:86:19
at http://localhost:3000/packages/tracker.js?6d0890939291d9780f7e2607ee3af3e7f98a3d9c:296:31
at Object.Tracker.nonreactive (http://localhost:3000/packages/tracker.js?6d0890939291d9780f7e2607ee3af3e7f98a3d9c:593:12)
at Tracker.Computation.invalidate (http://localhost:3000/packages/tracker.js?6d0890939291d9780f7e2607ee3af3e7f98a3d9c:295:15)
at Tracker.Computation.stop (http://localhost:3000/packages/tracker.js?6d0890939291d9780f7e2607ee3af3e7f98a3d9c:312:10)
at attrTeardown (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:1542:26)
at TeardownCallback.go (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:199:11)
at HTMLSpanElement.$jq.event.special.(anonymous function).teardown (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:255:13)
at Object.jQuery.event.remove (http://localhost:3000/packages/jquery.js?dd8bac56f8fd3666d433d2285ae01e52597cc51a:4503:48)
at Function.jQuery.extend.cleanData (http://localhost:3000/packages/jquery.js?dd8bac56f8fd3666d433d2285ae01e52597cc51a:5741:22)

The offending line is:

_timers[cid].destroy();

I'm using Chronos.currentTime() in the query for specific collections, ex:

Template.fooList.helpers({
  cursor: function(){
    return FooCollection.find({expires: {$lt: Chronos.currentTime()}});
  }
});

I'm not using any of the other features of Chronos yet.

@MichelFloyd
Copy link
Contributor Author

A side consequence of this bug is that templates don't get unloaded properly and so can't be reopened later :(

@MichelFloyd
Copy link
Contributor Author

ok, I figured this out. comp.invalidate is being called twice for certain computations so the second time there is nothing to destroy. I'll fork and make a pull request.

remcoder added a commit that referenced this issue May 31, 2015
@remcoder
Copy link
Owner

Actually, it's weird that comp.onInvalidate is being called twice. The docs explicitly say it's a 'one-time callback'. Or am I misreading something?

oh well.. :-P

@MichelFloyd
Copy link
Contributor Author

It is weird. I was looking at the cid that was being destroyed and sure enough I would see it being created once then destroyed twice.

It could be a peculiarity of my app and/or the packages I’m using. Where I saw it occur first was when closing a bootbox modal.

On May 31, 2015, at 11:09 AM, Remco Veldkamp [email protected] wrote:

Actually, it's weird that comp.onInvalidate is being called twice. The docs explicitly say it's a 'one-time callback'. Or am I misreading something?

oh well.. :-P


Reply to this email directly or view it on GitHub.

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