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
Comments
I've been having this problems too.
|
They said it only happens in Chrome. And actually it does. |
Any luck on the issue? On Thu, Jul 23, 2015 at 8:51 PM, Seokjun Kim notifications@github.com
Best, William Truong |
The same here. I can just guess where the issue is because I don't see my app files in the error:
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). |
I don't use Iron Router, and it occurs for me in Chrome. |
I use FlowRouter. And it might be related to ReactiveVar. When it sets value in ReactiveVar it occurs. |
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: |
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 |
I found that I have the problem with chome |
+1 |
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
This corroborates the opinion of Nathan M (Jul 24 at 0:46) at the bottom here I think: |
+1 |
1 similar comment
+1 |
+1, same problem but it happens to me when inserting data from a non-meteor API into a client-side Mongo collection |
+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. |
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:
and elsewhere in my project I'm inserting new items like this (data is 10 items long):
Meteor decides to throw our wonderful error after the 4th or so call to
BUT if I change the helper function
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:
|
I'm also getting this error.
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.
And another perhaps related error that sometimes appears on the same page instead.
UpdateI 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. |
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):
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 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 |
+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 This was easy enough to fix by using a ternary in the property assignment in the code to set the class programmatically. |
I ran into another instance in my app giving the same exception I posted above starting with:
The same workaround was relatively simple and seems to have solved it again: 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. |
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? |
I can reproduce the message under Chrome by trying to set a session under my app Template .rendered as shown below:
I am using meteor 1.1.6 |
Code to pin down the bug:Sample log:
Analysis:self._dependentsById is an array that's being iterated through using the following indexes: It goes smoothly until it should reach 8036, but instead it uses 0 as index, gets Naive solution:Check array entry before calling Pull request: |
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();
}
}
}
} |
+1 |
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 |
@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. |
+1, as mentioned by xPandismo, happens with |
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. |
@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. |
I had the same problem. Fixed with Chromium 45.0.2454.85. |
+1 |
I confirm that the issue disappeared after the browser update. |
the same for me too "TypeError: Cannot read property 'hydrated' of undefined in [null]" |
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! |
_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.
The text was updated successfully, but these errors were encountered: