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

Components called from a bound handlebars helper fail to render in 1.8.0 beta 1 #5556

Closed
Bestra opened this issue Sep 6, 2014 · 2 comments
Closed

Comments

@Bestra
Copy link
Contributor

Bestra commented Sep 6, 2014

I'm using a handlebars helper that calls a component based on its parameter.

Ember.Handlebars.registerBoundHelper('display', function(type, options) {
  var componentName = "display-" + type,
  helper = Em.Handlebars.resolveHelper(options.data.view.container, componentName);
  return helper.call(this, options);
});

You can see a working jsbin with beta 1.7 here

In 1.8 beta 1 the page throws Uncaught TypeError: Cannot read property 'pushChildView' of null
Here's the failing jsbin: http://emberjs.jsbin.com/vowid/4/edit
It looks like the parent view's render buffer hasn't been set up yet but I'm pretty unfamiliar with the rendering lifecycle at this point. Is this a regression from 1.7 or was I doing it wrong in the first place?

@krisselden
Copy link
Contributor

registerBoundHelper is to make helpers that process simple bindings for formatting, the helper creates a view that doesn't support children, so you can't currently call another helper that adds a view. Prior to this beta, this sort of worked, though it had edge cases.

We are continuing to improve consistency of unquoted paths meaning it is bound to that property, so hopefully {{#view boundView ...}} will work soon. We likely can add a {{#component boundComponent }} too. There is ongoing work to make all the helpers consistent that hopefully will land in this beta. You can also use the private helper API, but it's kind of complex at the moment, and you will have to redo it when htmlbars lands.

@Bestra
Copy link
Contributor Author

Bestra commented Sep 7, 2014

Thanks for the explanation! I'm going to close this issue for now since my problem falls somewhat into the "you're doing it wrong" category. I'll check on the forum to see if anyone has other patterns for polymorphic-ish component rendering.

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

2 participants