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

Randomly occurs: "TypeError: Cannot read property 'invalidate' of undefined" #4793

Closed
wtruong02151 opened this issue Jul 22, 2015 · 36 comments
Closed

Comments

@wtruong02151
Copy link

_9 Upvotes_ On what seems to be random occasions, when a user on my website tries to answer a question on the quiz page, the following error occurs:

TypeError: Cannot read property 'invalidate' of undefined
at Tracker.Dependency.changed (tracker.js:388)
at ReactiveVar.set (reactive-var.js:82)
at null. (builtins.js:22)
at view.js:191
at Function.Template._withTemplateInstanceFunc (template.js:437)
at view.js:190
at Object.Blaze._withCurrentView (view.js:523)
at viewAutorun (view.js:189)
at Tracker.Computation._compute (tracker.js:294)
at Tracker.Computation._recompute (tracker.js:313)

I don't know why this occurs, and I am not entirely sure what this error even means so if someone could point me in the right direction, that would be great!

Note: this error seems to only occur when using Chrome.

@colus001
Copy link

I've been having this problems too.

TypeError: Cannot read property 'invalidate' of undefined
    at Tracker.Dependency.changed
    at ReactiveVar.set
    at null.<anonymous>
    at /packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:1865:18
    at Function.Template._withTemplateInstanceFunc
    at /packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:1864:29
    at Object.Blaze._withCurrentView
    at viewAutorun
    at Tracker.Computation._compute
    at Tracker.Computation._recompute undefined

@colus001
Copy link

sandstorm-io/sandstorm#578

They said it only happens in Chrome. And actually it does.

@wtruong02151
Copy link
Author

Any luck on the issue?

On Thu, Jul 23, 2015 at 8:51 PM, Seokjun Kim notifications@github.com
wrote:

sandstorm-io/sandstorm#578
sandstorm-io/sandstorm#578

They said it only happens in Chrome. And actually it does.


Reply to this email directly or view it on GitHub
#4793 (comment).

Best,
William

William Truong
Brown University, Class of 2017
781-789-5981
william_truong@brown.edu

@Elfoslav
Copy link

The same here. I can just guess where the issue is because I don't see my app files in the error:

Exception from Tracker recompute function: undefined
debug.js:43 TypeError: Cannot read property 'invalidate' of undefined
    at Tracker.Dependency.changed (http://localhost:3000/packages/tracker.js?6d0890939291d9780f7e2607ee3af3e7f98a3d9c:421:29)
    at ReactiveVar.set (http://localhost:3000/packages/reactive-var.js?20335b7b37165980ddd9f23943b2e5b00aae1cc2:117:12)
    at null.<anonymous> (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2599:22)
    at http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:1865:18
    at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:3476:12)
    at http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:1864:29
    at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2197:12)
    at viewAutorun (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:1863:18)
    at Tracker.Computation._compute (http://localhost:3000/packages/tracker.js?6d0890939291d9780f7e2607ee3af3e7f98a3d9c:327:36)
    at Tracker.Computation._recompute (http://localhost:3000/packages/tracker.js?6d0890939291d9780f7e2607ee3af3e7f98a3d9c:346:14) 

It happens only in Chrome, when I change a route, so it's probably an issue with Iron Router. I noticed this just recently (today).

@jholl
Copy link

jholl commented Jul 26, 2015

I don't use Iron Router, and it occurs for me in Chrome.

@colus001
Copy link

I use FlowRouter. And it might be related to ReactiveVar. When it sets value in ReactiveVar it occurs.

@arleonard
Copy link

I am getting the same issue with Chrome/IronRouter. For me, I only getting it when using a helper to see if a value exists:
HTML (not working):
<img src="{{#if has_thumbnail}}{{url_thumbnail}}{{else}}{{url}}{{/if}}">
HTML (working):
<img src="{{url}}">
Javascript:
has_thumbnail: function() { return this.url_thumbnail != null; }

@anubhav94
Copy link
Contributor

Hey Everyone,

Thanks for pointing this issue out and we can see that it seems to be a recurring issue. We'd love to fix it but we need a very simple reproduction that we can use to figure out what the problem is. I'm going to leave the issue open for now, but we'd need a reproduction to debug and fix the issue. Here's a document that explains how to provide the reproduction: https://github.com/meteor/meteor/wiki/Contributing-to-Meteor#reporting-a-bug-in-meteor

@johannbotha
Copy link

I found that I have the problem with chome 44.0.2403.125 (64-bit) but not with 43.0.2357.130 (64-bit)

@lucasrosa
Copy link

+1

@andrewrobinson
Copy link

I have this problem on Chrome(44.0.2403.125 (64-bit)) too. Safari(8.0.7 (10600.7.12)) has no problems, but interestingly Firefox(39.0) gives me this warning about meteor.js 533:6

"mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create"

It then shows the warning as coming from line 16:

e.proto = errorClass.prototype;

here in packages/meteor/errors.js:

https://github.com/meteor/meteor/blob/devel/packages/meteor/errors.js

Meteor.makeErrorType = function (name, constructor) { var errorClass = function (/*arguments*/) { var self = this; // Ensure we get a proper stack trace in most Javascript environments if (Error.captureStackTrace) { // V8 environments (Chrome and Node.js) Error.captureStackTrace(self, errorClass); } else { // Firefox var e = new Error; e.__proto__ = errorClass.prototype; if (e instanceof errorClass) self = e;

This corroborates the opinion of Nathan M (Jul 24 at 0:46) at the bottom here I think:

http://stackoverflow.com/questions/31596190/randomly-occurs-with-meteor-typeerror-cannot-read-property-invalidate-of-un

@steph643
Copy link

+1

1 similar comment
@mchlbyrd
Copy link

+1

@connorblack
Copy link

+1, same problem but it happens to me when inserting data from a non-meteor API into a client-side Mongo collection

@gferrin
Copy link

gferrin commented Jul 31, 2015

+1 - happening to me on a feed when I try to add/remove elements. It seems to be happening to whatever reactive data is in a helper function.

Causes either elements to just repeat in the feed or sometimes causes the entire thing to disappear.

@connorblack
Copy link

I'm working on reproducing the error in a simplified separate project, but here's some stuff I have so far:

Say I have a helper function like this:

Template.templateName.helpers
    items: () ->
        return localClientCollection.find({}).fetch()

and elsewhere in my project I'm inserting new items like this (data is 10 items long):

newItems: (data) ->
    for item in data
         localClientCollection.insert(item)

Meteor decides to throw our wonderful error after the 4th or so call to newItems and results in list getting messed up (items that were at the end of the list when the error occurred now always get added to the end of the list again. i.e. my rendered list will have ~110 items but my collection only has 100):

Exception from Tracker recompute function: debug.js:41 
TypeError: Cannot read property 'invalidate' of undefined debug.js:41 

BUT if I change the helper function items and newItems function to something like this:

Template.templateName.helpers
    items: () ->
        newItems = Session.get('newItems')
        if newItems
            return localClientCollection.find({}).fetch()
...

newItems: (data) ->
    for item in data
         localClientCollection.insert(item)
    Session.set('newItems', true)

the error doesn't express itself. Some other annoying UX problems occur, but this is just a workaround to try to nail down where the problem is happening.

Some other things to note:

  • If I only insert one item per call into localClientCollection the error doesn't seem to occur, which leads me to think mass inserts/quick succession recomputes might have something to do with it
  • This is only an issue in modern desktop chrome (I'm on Mac OSX 10.10.4) - firefox, safari and mobile chrome all are unaffected
  • I believe this was introduced in a very recent version of chrome - I don't recall running into this error a few weeks ago

@AnthonyAstige
Copy link

I'm also getting this error.

  • Website built with Meteor 1.1.0.2.
  • Browsing with Chrome Version 44.0.2403.107 (64-bit) on Ubuntu 15.04.

I'm working with Session variables in a reactive form. I'm not seeing a completely consistent pattern to reproduce this error, though if I make a significant number of clicks (50+) the error seems to appear.

Exception from Tracker recompute function:
debug.js:41 TypeError: Cannot read property 'invalidate' of undefined
    at Tracker.Dependency.changed (tracker.js:388)
    at ReactiveVar.set (reactive-var.js:82)
    at builtins.js:154
    at Object.Tracker.nonreactive (tracker.js:560)
    at Object.Blaze.Each.eachView.onViewCreated.eachView.stopHandle.ObserveSequence.observe.changedAt (builtins.js:144)
    at observe_sequence.js:274
    at Function._.each._.forEach (underscore.js:113)
    at diffArray (observe_sequence.js:260)
    at observe_sequence.js:108
    at Object.Tracker.nonreactive (tracker.js:560)

And another perhaps related error that sometimes appears on the same page instead.

Exception from Tracker recompute function:
debug.js:41 Error: Bad index in range.removeMember: 6
    at DOMRange.removeMember (http://meteor.loc:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:558:11)
    at http://meteor.loc:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2707:32
    at Object.Tracker.nonreactive (http://meteor.loc:3000/packages/tracker.js?6d0890939291d9780f7e2607ee3af3e7f98a3d9c:593:12)
    at Object.Blaze.Each.eachView.onViewCreated.eachView.stopHandle.ObserveSequence.observe.removedAt (http://meteor.loc:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2702:17)
    at Object.diffFn.removed (http://meteor.loc:3000/packages/observe-sequence.js?0532a9dd76dd78f543eb4d79a1e429df186d8bde:292:17)
    at http://meteor.loc:3000/packages/minimongo.js?af9eb9d7447544ca9b839a3dcf7ed2da2209b56c:3660:36
    at Array.forEach (native)
    at Function._.each._.forEach (http://meteor.loc:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:156:11)
    at LocalCollection._diffQueryOrderedChanges (http://meteor.loc:3000/packages/minimongo.js?af9eb9d7447544ca9b839a3dcf7ed2da2209b56c:3658:5)
    at diffArray (http://meteor.loc:3000/packages/observe-sequence.js?0532a9dd76dd78f543eb4d79a1e429df186d8bde:214:3)

Update

I found Blaze not setting "selected" attribute #3191 while debugging what I thought was an unrelated issue. Patching the workaround mentioned there seems to have also resolved or at least mitigated the issue here.

@connorblack
Copy link

So after much debugging I've been able to successfully mitigate/reproduce the error in my project. It seems to indeed be a recomputing issue, and I think might have something to do with known Blaze problems laid out in this issue #3596 (before finding this, I had my list item in a modular sub-template, but given how poorly Blaze performs on mobile with sub-templates I had to bring it up into its parent template).

Basically, I have a list of items in my project where certain button states are based on persisted and realtime user actions. The list starts with 10 items and infinitely scrolls until the end (~500-1000). For example, I have something along the lines of this (a simplified example - my actual item UI is a bit more complex):

{{#each items}}
   ...
   <div class="item-wrap">
       {{#if this.thisState}}
            <button class=" {{#if this.thisStateDone}}disabled{{/if}}">DoThis</button>
       {{else}}
            <button class=" {{#if this.thatStateDone}}disabled{{/if}}>DoThat</button>
       {{/if}}
   </div>
   ...
{{/each}}

To fix the problem I commented out everything in the item except for some basic text, and I was able to paginate through my list without any issue. Then one by one I added back in helpers, found which ones seemed to be the biggest culprits and added some efficiency tricks. Something that seemed to have the biggest effect was showing buttons/states based on the parent's CSS class, using display properties, instead of through Blaze #ifs.

Granted, some issues were on me and should have been optimized anyway, but my item UI/UX is fairly basic and now I'm basically at the ceiling of what I can do. If I needed something more complex/more modularized, it would be impossible.

I'm of the opinion that Blaze on the whole has some serious efficiency problems and is not ready for primetime. I ultimately regret using it in my project. It has caused endless headaches that I wouldn't have had to otherwise deal with if I were using Backbone, React or Angular.

It does seem that the Meteor team recognizes this to some extent, and is planning on making the platform compatible with a couple client-side MVCs suited for complex UI/UX, such as Angular and React - something I'm very excited about: http://info.meteor.com/blog/whats-coming-in-meteor-12-and-beyond

@mwmancuso
Copy link

+1, but it doesn't seem to break anything as far as I can tell.

EDIT: It is also {{#if}} related for me.

I have a block of code:

<template name="lookupItem">
    <div class="item {{#if placeholder}}placeholder{{/if}} {{#if selected}}selected{{/}}" title="{{text}}" data-index="{{index}}">{{text}}</div>
</template>

If I remove {{#if selected}}selected{{/if}} all works normally. It may be important to note that placeholder is set inline by the parent template and does not seem to be causing the problem. selector, on the other hand, is set by a template helper.

This was easy enough to fix by using a ternary in the property assignment in the code to set the class programmatically.

@AnthonyAstige
Copy link

I ran into another instance in my app giving the same exception I posted above starting with:

Exception from Tracker recompute function:
debug.js:41 TypeError: Cannot read property 'invalidate' of undefined

The same workaround was relatively simple and seems to have solved it again:

screenshot from 2015-08-02 15 15 52

The exception would show up a lot when I would change my collection entry. More frequent I think when the page was freshly loaded. Maybe one out of 3-10 times a change occurred. The related variables are a bit complex on the backend with a db retrieval and local caching.

@johanbrook
Copy link

We get this in Meteor 1.0.4.2 on Chrome 44.0.2403.125 (64-bit) all over our app, which suggests it's something that's changed in Blaze which affects a common template pattern?

@mahmoudkm
Copy link

I can reproduce the message under Chrome by trying to set a session under my app Template .rendered as shown below:

    Template.orderPage.rendered = function(){
             Session.set('doc_id', {_id: "XtvYLWRAccijfwR2R"});
    }

I am using meteor 1.1.6

@eluck
Copy link

eluck commented Aug 7, 2015

Code to pin down the bug:

image

Sample log:

tracker.js:388 Dependency.prototype.changed - self._dependentsById: Object {1421: T…r.Computation, 1427: T…r.Computation, 1428: T…r.Computation, 1430: T…r.Computation, 1432: T…r.Computation, 1434: T…r.Computation, 1436: T…r.Computation, 1439: T…r.Computation, 1441: T…r.Computation, 1443: T…r.Computation, 1447: T…r.Computation, 1450: T…r.Computation, 1452: T…r.Computation, 1454: T…r.Computation, 1456: T…r.Computation, 1458: T…r.Computation, 1460: T…r.Computation, 8036: T…r.Computation, 8037: T…r.Computation, 8038: T…r.Computation, 8039: T…r.Computation}1421: Tracker.Computation1427: Tracker.Computation1428: Tracker.Computation1430: Tracker.Computation1432: Tracker.Computation1434: Tracker.Computation1436: Tracker.Computation1439: Tracker.Computation1441: Tracker.Computation1443: Tracker.Computation1447: Tracker.Computation1450: Tracker.Computation1452: Tracker.Computation1454: Tracker.Computation1456: Tracker.Computation1458: Tracker.Computation1460: Tracker.Computation8135: Tracker.Computation8136: Tracker.Computation8137: Tracker.Computation8138: Tracker.Computation__proto__: Object
2015-08-08 01:38:43.499 tracker.js:390 Dependency.prototype.changed - id: 1421
2015-08-08 01:38:43.499 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1421, _onInvalidateCallbacks: Array[12]…}
2015-08-08 01:38:43.499 tracker.js:390 Dependency.prototype.changed - id: 1427
2015-08-08 01:38:43.499 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1427, _onInvalidateCallbacks: Array[1]…}
2015-08-08 01:38:43.500 tracker.js:390 Dependency.prototype.changed - id: 1428
2015-08-08 01:38:43.500 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1428, _onInvalidateCallbacks: Array[6]…}
2015-08-08 01:38:43.500 tracker.js:390 Dependency.prototype.changed - id: 1430
2015-08-08 01:38:43.500 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1430, _onInvalidateCallbacks: Array[2]…}
2015-08-08 01:38:43.501 tracker.js:390 Dependency.prototype.changed - id: 1432
2015-08-08 01:38:43.501 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1432, _onInvalidateCallbacks: Array[6]…}
2015-08-08 01:38:43.501 tracker.js:390 Dependency.prototype.changed - id: 1434
2015-08-08 01:38:43.501 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1434, _onInvalidateCallbacks: Array[4]…}
2015-08-08 01:38:43.501 tracker.js:390 Dependency.prototype.changed - id: 1436
2015-08-08 01:38:43.502 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1436, _onInvalidateCallbacks: Array[1]…}
2015-08-08 01:38:43.502 tracker.js:390 Dependency.prototype.changed - id: 1439
2015-08-08 01:38:43.502 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1439, _onInvalidateCallbacks: Array[4]…}
2015-08-08 01:38:43.502 tracker.js:390 Dependency.prototype.changed - id: 1441
2015-08-08 01:38:43.502 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1441, _onInvalidateCallbacks: Array[6]…}
2015-08-08 01:38:43.503 tracker.js:390 Dependency.prototype.changed - id: 1443
2015-08-08 01:38:43.503 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1443, _onInvalidateCallbacks: Array[1]…}
2015-08-08 01:38:43.503 tracker.js:390 Dependency.prototype.changed - id: 1447
2015-08-08 01:38:43.503 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1447, _onInvalidateCallbacks: Array[4]…}
2015-08-08 01:38:43.503 tracker.js:390 Dependency.prototype.changed - id: 1450
2015-08-08 01:38:43.504 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1450, _onInvalidateCallbacks: Array[1]…}
2015-08-08 01:38:43.504 tracker.js:390 Dependency.prototype.changed - id: 1452
2015-08-08 01:38:43.504 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1452, _onInvalidateCallbacks: Array[8]…}
2015-08-08 01:38:43.504 tracker.js:390 Dependency.prototype.changed - id: 1454
2015-08-08 01:38:43.504 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1454, _onInvalidateCallbacks: Array[1]…}
2015-08-08 01:38:43.505 tracker.js:390 Dependency.prototype.changed - id: 1456
2015-08-08 01:38:43.505 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1456, _onInvalidateCallbacks: Array[6]…}
2015-08-08 01:38:43.505 tracker.js:390 Dependency.prototype.changed - id: 1458
2015-08-08 01:38:43.505 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1458, _onInvalidateCallbacks: Array[1]…}
2015-08-08 01:38:43.506 tracker.js:390 Dependency.prototype.changed - id: 1460
2015-08-08 01:38:43.506 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: T…r.Computation {stopped: false, invalidated: false, firstRun: false, _id: 1460, _onInvalidateCallbacks: Array[8]…}
2015-08-08 01:38:43.506 tracker.js:390 Dependency.prototype.changed - id: 0
2015-08-08 01:38:43.506 tracker.js:391 Dependency.prototype.changed - self._dependentsById[id]: undefined
2015-08-08 01:38:43.509 debug.js:43 Exception from Tracker recompute function: undefined
2015-08-08 01:38:43.509 debug.js:43 TypeError: Cannot read property 'invalidate' of undefined
    at Tracker.Dependency.changed (http://localhost:3000/packages/tracker.js?deaf3bb98b152c9a86a0f29d8362f6b277122a78:425:29)
    at ReactiveVar.set (http://localhost:3000/packages/reactive-var.js?20335b7b37165980ddd9f23943b2e5b00aae1cc2:117:12)
    at http://localhost:3000/packages/blaze.js?4db469cb07a18d4894708d7f6425590223777061:2733:30
    at Object.Tracker.nonreactive (http://localhost:3000/packages/tracker.js?deaf3bb98b152c9a86a0f29d8362f6b277122a78:599:12)
    at Object.Blaze.Each.eachView.onViewCreated.eachView.stopHandle.ObserveSequence.observe.changedAt (http://localhost:3000/packages/blaze.js?4db469cb07a18d4894708d7f6425590223777061:2722:17)
    at http://localhost:3000/packages/observe-sequence.js?0532a9dd76dd78f543eb4d79a1e429df186d8bde:313:21
    at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:164:22)
    at diffArray (http://localhost:3000/packages/observe-sequence.js?0532a9dd76dd78f543eb4d79a1e429df186d8bde:299:5)
    at http://localhost:3000/packages/observe-sequence.js?0532a9dd76dd78f543eb4d79a1e429df186d8bde:147:9
    at Object.Tracker.nonreactive (http://localhost:3000/packages/tracker.js?deaf3bb98b152c9a86a0f29d8362f6b277122a78:599:12) undefined

Analysis:

self._dependentsById is an array that's being iterated through using the following indexes:
1421, 1427, 1428, 1430, 1432 ... 1460, 8036, 8037, 8038, 8039

It goes smoothly until it should reach 8036, but instead it uses 0 as index, gets undefined from array using this index, and tries to call invalidate on undefined which causes the exception. This means that the iterated array has been modified during the iteration. Thus, we deal with a race condition here.

Naive solution:

Check array entry before calling invalidate on it:

image

Pull request:

#4908

@eluck
Copy link

eluck commented Aug 8, 2015

BTW, for the time being, this snippet fixes the problem:

if (Meteor.isClient) {
  var MeteorVersion = Meteor.release.replace(/[.@METRO]+/g, '');
  MeteorVersion += new Array(5 - MeteorVersion.length).join('0');
  if (Number(MeteorVersion) <= 1103) {
    console.log('Updating Tracker.Dependency.prototype.changed function');
    Tracker.Dependency.prototype.changed = function () {
      var self = this;
      for (var id in self._dependentsById) {
        var dependent = self._dependentsById[id];
        if (dependent) dependent.invalidate();
      }
    }
  }
}

@krstffr
Copy link

krstffr commented Aug 11, 2015

+1

@deanrad
Copy link

deanrad commented Aug 11, 2015

The patch seems harmless, but the version checking is a bit obtuse. How bout not doing adhoc semver, and just saying - If you have Meteor 1.1.0.3 or less, here's the patch:

console.log('Patching Tracker.Dependency.prototype.changed function for https://github.com/meteor/meteor/issues/4793');
Tracker.Dependency.prototype.changed = function () {
  var self = this;
  for (var id in self._dependentsById) {
    var dependent = self._dependentsById[id];
    if (dependent) dependent.invalidate();
  }
}

Also, @eluck - any theories why _dependentsById could change during iteration in a single threaded language ?

@eluck
Copy link

eluck commented Aug 12, 2015

@deanius Some kind of complex nesting? I.e. when a top-level dependent can also depend on another top-level dependent. When the latter is recalculated, the former can get removed during the recalculation. Just a theory.

@johnthepink
Copy link
Contributor

@deanius and @eluck's patch worked for me. The issue doesn't seem to be present in the latest Chrome stable on OSX released 8/11/2015, Version 44.0.2403.155 (64-bit), but it was present in Chrome 44.0.2403.130 (64-bit).

@aunz
Copy link

aunz commented Sep 1, 2015

+1, as mentioned by xPandismo, happens with {{#if}} as in <a class="{{#if selected}} selected {{/if}}"</a>

@avital
Copy link
Contributor

avital commented Sep 4, 2015

I'd love to dig deeper into this, but it looks like the Chrome team makes it intentionally impossible to install old verisons. @johnthepink and everyone else here, can you verify whether indeed Chrome 44.0.2403.155 fixes the problem for you all?

This really does sound like a bug in Chrome that only manifests itself in some extreme edge case... I was hoping to find a clue in the Chrome changelog between 44.0.2403.130 and 44.0.2403.155 but couldn't find anything that seemed relevant.

@johnthepink
Copy link
Contributor

@avital the only confirmation I can offer is that I haven't seen it since the update. Sorry I can't be of more help.

@ni-ko-o-kin
Copy link

I had the same problem. Fixed with Chromium 45.0.2454.85.

@maxnowack
Copy link
Contributor

+1

@eluck
Copy link

eluck commented Sep 16, 2015

I confirm that the issue disappeared after the browser update.

@cpapidas
Copy link

the same for me too "TypeError: Cannot read property 'hydrated' of undefined in [null]"

@abernix
Copy link
Contributor

abernix commented Jan 20, 2017

I'm going to close this issue because it doesn't seem particularly popular anymore and is based on a very old version of Meteor. A lot has changed so if you're still having this problem, please open a new issue with details according to reporting a bug. Thanks!

@abernix abernix closed this as completed Jan 20, 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