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

moduleForHelper with metal-views #5595

Closed
manuelmitasch opened this issue Sep 16, 2014 · 7 comments
Closed

moduleForHelper with metal-views #5595

manuelmitasch opened this issue Sep 16, 2014 · 7 comments

Comments

@manuelmitasch
Copy link

We are testing our handlebars helpers with the moduleForHelper from this never merged ember-qunit PR. Which worked fine until 1.7. With 1.8 beta-1 (which includes the metal-view refactorings) the helper stops working.

I have created a jsbin that demonstrates the problem.
Any idea what has changed or what the solution could be?

I'm reporting this here to make sure this is not an unknown bug introduced through the metal-view refactorings.
PING @krisselden @rwjblue

@matthiasleitner
Copy link

I updated the jsbin and removed the call

Ember.Handlebars.helper(name, helper);

Tests are passing but I am not sure what change caused this issue. I am also not sure why the helper is re-registered and restored during setup and teardown of moduleForHelper but assume it isn't really necessary.

@mixonic
Copy link
Sponsor Member

mixonic commented Sep 30, 2014

@manuelmeurer there is a ton of code in moduleForHelper, and it is coupled to other logic in ember-qunit. If you can narrow down the bug to a specific issue it would help us address it more quickly.

@manuelmeurer
Copy link
Contributor

You meant @manuelmitasch, right? 😄

@stefanpenner
Copy link
Member

this seems like a ember-qunit bug not ember proper

@mixonic
Copy link
Sponsor Member

mixonic commented Sep 30, 2014

@manuelmeurer haha, yes :-) Sorry about that.

@manuelmitasch
Copy link
Author

@mixonic It's a quite mysterious bug and solution. I have used hours to dig into stacktraces of the involved libraries (ember, qunit, ember-qunit, handlebars). It's quite complex. I tried to narrow it down. Did not succeed. It come down to adding or removing Ember.Handlebars.helper(name, helper);. I'm also confused why this was there in the frist place. Anything else does not have an effect.

Thanks to @matthiasleitner we are able to make the move to metal views. Yeah.

@krisselden
Copy link
Contributor

Ember.Handlebars.helper('my-helper', function(value, options) { ... }); form creates a SimpleHandlebarsView which has some optimizations by assuming it is a leaf node because this API was intended for helpers that do formatting. You can't call into the view helper from in these functions. While this may have appeared to work in the past versions, it actually did not structure the hierarchy properly, and required recursive rendering to actually partially work. It now fails fast.

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

6 participants