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

[Glimmer] Late bound layouts #13588

Merged
merged 2 commits into from
Jun 5, 2016
Merged

Conversation

chadhietala
Copy link
Contributor

@chadhietala chadhietala commented Jun 2, 2016

In Ember we typically leverage convention over configuration for figuring out what component class goes with which template. That being said, today it's totally valid to opt-out of those conventions by importing the template into the class and setting it as the layout for the component. This PR re-introduces the support for this functionality. Depends on glimmerjs/glimmer-vm#179

@chadhietala chadhietala changed the title Late bound Late bound layouts Jun 2, 2016
@@ -1,162 +0,0 @@
import { get } from 'ember-metal/property_get';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't makes any more sense with components.

@chadhietala chadhietala changed the title Late bound layouts [Glimmer] Late bound layouts Jun 2, 2016
template = owner.lookup('template:' + layoutName);
}
if (!template) {
template = component.defaultLayout;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a template factory too?

@krisselden krisselden self-assigned this Jun 4, 2016
lateBound(template) {
let definition;
if (this._cache) {
definition = this._cache[template.id];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given we create new instances from directly imported modules we likely should cache the instance we created for our env from the factory, otherwise the component will recreate and recompile everything if you directly import it onto layout.

@homu
Copy link
Contributor

homu commented Jun 4, 2016

☔ The latest upstream changes (presumably #13601) made this pull request unmergeable. Please resolve the merge conflicts.

@chadhietala chadhietala force-pushed the late-bound branch 4 times, most recently from 43086ca to 3b16b63 Compare June 5, 2016 02:20
QUnit.test('when wrapped in a template, precompile is the same as compile', (assert) => {
// Simulating what happens in a broccoli plugin
// when it is creating an AMD module
let precompiled = template(precompile('Hello'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in an amd module, eval("require('template')("+precompile('Hello')+")")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should assert that precompile returns a string, and that when it is evaluated, it returns what template() expects.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krisselden krisselden merged commit 0f2d9e6 into emberjs:master Jun 5, 2016
toddjordan pushed a commit to toddjordan/ember.js that referenced this pull request Sep 9, 2016
* Updating glimmer-engine WIP

* [Glimmer2] Late bound layouts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants