I've been running into a weird bug while working on Telescope. Currently, clicking submit on a post edit page triggers this error multiple time:
Exception from Meteor.flush: TypeError: Cannot read property 'parentNode' of null
I've narrowed it down to post_edit.html:
<div class="control-group post-form-category">
<label class="control-label">Category</label>
<div class="controls">
{{#each categories}}
<label class="radio inline">
<input id="category_{{_id}}" type="radio" value="{{name}}" name="category" {{#if isChecked }} checked {{/if}}/> {{name}}
</label>
{{/each}}
</div>
</div>
And here's the categories helper:
categories: function(){
return Categories.find();
}
If you remove both {{#each}} loops (one in .post-form.category and another one in .post-form-user) the error goes away. Any idea what's going on? Am I doing something wrong with those {{#each}}?
UPDATE
It really seems like the problem is coming from the "checked" attribute. But even doing something like
<input type="radio" value="{{name}}" name="category" {{isChecked}} />
Still triggers the error.
The problem is we don't support {{#if isChecked }} checked {{/if}}. You can't use a block helper (including #if) inside an HTML tag; you have to write a helper that returns the appropriate string instead.
It turns out this is related to a bug in Meteor. Until the bug is fixed, there's a simple solution:
Make the #each in the SELECT not reactive, by going into post_edit.js and replacing Meteor.users.find() with Meteor.users.find().fetch().
Thanks to @dgreensp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With