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

Wrong context when rendering a component instance with the {{view}} helper #10401

Closed
tobyzerner opened this issue Feb 9, 2015 · 3 comments · Fixed by #10527
Closed

Wrong context when rendering a component instance with the {{view}} helper #10401

tobyzerner opened this issue Feb 9, 2015 · 3 comments · Fixed by #10527
Milestone

Comments

@tobyzerner
Copy link

When passing a view instance into the {{view}} helper, the context inside the view's template remains the same as that of the parent.

Demo (1.10, broken): http://emberjs.jsbin.com/widubeyuti/1/edit

Demo (1.9, working): http://emberjs.jsbin.com/nuracayaxu/1/edit

@tobyzerner tobyzerner changed the title Wrong context when rendering an instance with the {{view}} helper Wrong context when rendering a component instance with the {{view}} helper Feb 9, 2015
@tobyzerner
Copy link
Author

The line causing the context to be overwritten is this one: https://github.com/emberjs/ember.js/blob/master/packages/ember-htmlbars/lib/system/append-templated-view.js#L32

I think the issue here is that the component being passed in doesn't have a controller, so its context gets overwritten. But components have their own context, so the context shouldn't get overwritten.

@mmun mmun added the Regression label Feb 9, 2015
@rwjblue rwjblue added this to the 1.10.1 milestone Feb 10, 2015
@rwjblue
Copy link
Member

rwjblue commented Feb 10, 2015

I believe this is the underlying issue in #10370 also.

@tobyzerner
Copy link
Author

I also noticed that any properties set on the {{view}} helper itself do not carry through. e.g.

{{view view.component text="Strawberries"}}

tobyzerner added a commit to flarum/framework that referenced this issue Feb 10, 2015
HTMLBars goodness! Since there was some breakage and a lot of fiddling
around to get some things working, I took this opportunity to do a big
cleanup of the whole Ember app. I accidentally worked on some new
features too :3

Note that the app is still broken right now, pending on
emberjs/ember.js#10401

Cleanup:
- Restructuring of components
- Consolidation of some stuff into mixins, cleanup of some APIs that
will be public
- Change all instances of .property() / .observes() / .on() to
Ember.computed() / Ember.observer() / Ember.on() respectively (I think
it is more readable)
- More comments
- Start conforming to a code style (2 spaces for indentation)

New features:
- Post hiding/restoring
- Mark individual discussions as read by clicking
- Clicking on a read discussion jumps to the end
- Mark all discussions as read
- Progressively mark the discussion as read as the page is scrolled
- Unordered list post formatting
- Post permalink popup

Demo once that Ember regression is fixed!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants