ember.js icon indicating copy to clipboard operation
ember.js copied to clipboard

Passing a view instance to the template view helper fails

Open ablanco opened this issue 12 years ago • 15 comments

Passing a view instance to the view helper worked fine in 1.7.0, but it has stopped working after the helper refactor. In 1.8.0 it fails and logs this message:

Assertion Failed: <instanceVbleName> must be a subclass of Ember.View, not <App.YourViewClass:ember857>

It's strange, because there is a method instanceHelper in the ViewHelper class, but that method is not called anywhere. It seems like now the helper doesn't identify properly an instance from the name of a class.

ablanco avatar Oct 29 '14 08:10 ablanco

@ablanco - Can you provide a small JSBin that demonstrates the issue?

rwjblue avatar Oct 29 '14 11:10 rwjblue

Here is the code: JSBin

The code there crashes, but if you remove the second view helper from the template then it will render properly. That second view helper is the one trying to load a view instance instead of a view class. Is this line:

{{view alertView}}

Removing that line everything works, but with that line on the template Ember crashes because it doesn't recognize alertView as a view instance. If you change the line loading Ember 1.8.0 in order to load Ember 1.7.0 it will work fine too, even with the second view helper on the template.

It seems like a regression in Ember 1.8.0.

ablanco avatar Oct 29 '14 11:10 ablanco

smells like a regression

mixonic avatar Oct 29 '14 12:10 mixonic

Agreed.

rwjblue avatar Oct 29 '14 12:10 rwjblue

This was fixed for stable branch in #9438. Still needs updates for streamified master branch before closing.

rwjblue avatar Oct 29 '14 22:10 rwjblue

Thanks for the quick fix!

ablanco avatar Oct 30 '14 12:10 ablanco

Closing this issue, as the PR for master is pending review (and this is already fixed on stable).

rwjblue avatar Oct 30 '14 22:10 rwjblue

Still broken for me. This code was working fine when I was still on 1.7 Error: screenshot 2014-11-26 18 00 00

Code: screenshot 2014-11-26 17 59 21

screenshot 2014-11-26 17 59 42

xypaul avatar Nov 27 '14 02:11 xypaul

This issue is also happening with me. screen shot 2014-12-18 at 12 51 38 pm

screen shot 2014-12-18 at 12 52 50 pm

robguilfoyle avatar Dec 18 '14 17:12 robguilfoyle

Should be fixed in #9881 folks. @rwjblue we may want to cut that 1.9.1 release this weekend.

mixonic avatar Dec 18 '14 19:12 mixonic

@mixonic - Agreed, that was my thought. I have a couple other things I would like to get in, but am waiting on feedback/clarification.

rwjblue avatar Dec 18 '14 19:12 rwjblue

this seems to be still broken even after the fix in #9881

balaf avatar Jan 04 '15 00:01 balaf

@balaf - please open a new issue with a reproducing JSBin

rwjblue avatar Jan 04 '15 00:01 rwjblue

Disregard. I can't reproduce it anymore. it must have been my mistake. Works fine

balaf avatar Jan 05 '15 10:01 balaf

Hi @rwjblue same issue with me, ember-cli version is 0.2.0-beta.1 this is my view code screenshot from 2015-03-11 22 10 07 and this is my template code screenshot from 2015-03-11 22 12 01 showing this error in console screenshot from 2015-03-11 22 15 02

narayand4 avatar Mar 11 '15 16:03 narayand4