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

[WIP] [BUGFIX canary] Allow contextual components to be a glimmer component #12617

Closed

Conversation

Serabe
Copy link
Member

@Serabe Serabe commented Nov 16, 2015

Currently, contextual components does not work when the component being closured is a glimmer component. This PR aims to fix #12590

  • Add auto flag to muts added by the compiler. (Needs some test)
  • Make GlimmerComponents render as a contextual component
  • Check which tests would make sense to have in both components and Glimmer components.
  • Unbox auto muts when rendering a component using the component helper if the component is a GlimmerComponent
  • Make appropiate changes to the node manager.
  • Test unboxing of auto muts
  • Make <my.comp> work
  • Remove unboxing of auto muts
  • Clean the code
  • Squash commits

@rwjblue
Copy link
Member

rwjblue commented Nov 16, 2015

The path/checklist seems correct to me.

@Serabe
Copy link
Member Author

Serabe commented Nov 20, 2015

Quick update: I haven't forgot about this. I'm doing some tests on Glimmer components before going full speed into solving the issue. I have divide first task in two since I need to implement the other feature to test it.

@Serabe
Copy link
Member Author

Serabe commented Nov 21, 2015

GlimmmerComponents can already be rendered as contextual components. I added the task of checking which tests in closure components would make sense to have for GlimmerComponents as well. I'll be doing that next (read it as tomorrow).

I have yet to do the mut unboxing, but I think there is a simple way by adding an optional parameter to getCellOrValue. I should not be modifying any part of the render process any more (unless not significantly).

@Serabe Serabe force-pushed the feature/contextual-glimmer-components branch 2 times, most recently from f68909e to 19817f7 Compare November 22, 2015 12:40
@@ -83,7 +85,7 @@ ComponentNodeManager.create = function ComponentNodeManager_create(renderNode, e
if (isAngleBracket) {
assert(`You cannot invoke the '${tagName}' component with angle brackets, because it's a subclass of Component. Please upgrade to GlimmerComponent. Alternatively, you can invoke as '{{${tagName}}}'.`, component.isGlimmerComponent);
} else {
assert(`You cannot invoke the '${tagName}' component with curly braces, because it's a subclass of GlimmerComponent. Please invoke it as '<${tagName}>' instead.`, !component.isGlimmerComponent);
assert(`You cannot invoke the '${tagName}' component with curly braces, because it's a subclass of GlimmerComponent. Please invoke it as '<${tagName}>' instead.`, !component.isGlimmerComponent || isClosureComponent || isComponentHelper);
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Is isClosureComponent threaded through here just for the assertion?

Perhaps we can just move the assertion further up the stack and avoid this. It kind of stinks to be passing these flags around.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Currently looking if I can just change isAngleBracket to mean behave like a GlimmerComponent. Otherwise, this can be hard to maintain.

@Serabe Serabe force-pushed the feature/contextual-glimmer-components branch from 19817f7 to f5bf7d0 Compare December 1, 2015 12:53
@Serabe
Copy link
Member Author

Serabe commented Dec 1, 2015

Some update on this:

I removed {auto: true} from the transformation, given that it is already being marked as internal. Furthermore, I changed slightly the code from this:

if (stream[MUTABLE_REFERENCE]) {
  return stream;
}

to:

if (stream[MUTABLE_REFERENCE] && !internal) {
  return stream;
}

given that a mutable stream needs to be marked internal to be unboxed if needed.

Some changes were introduced in the rendering process too. Some conditionals depend on the component being a GlimmerComponent, but others actually depend on it being called with angle brackets. Would it be possible to talk to someone in Slack to check a few things?

Last, I'll spend some time adding more tests, specially from #12613 to see we support GlimmerComponents properly. After all is working, I'll clean the code.

Sorry for the delay. Still working on this.

@mixonic
Copy link
Sponsor Member

mixonic commented Dec 1, 2015

@Serabe there has been some discussion about this lately, and it will need adjustment (sorry!). @wycats would like to hold off on invoking glimmer components with {{, which means they should not be invokable with the {{component helper or with {{dot.syntax.

However, dot syntax invocation with < should be supported. For example:

<my-form model=model as |f|>
  <f.button name='firstName' />
  <f.submit>Save</f.submit>
</my-form>

Of course this only applies to glimmer components. Happy to chat via Slack this week.

@homu
Copy link
Contributor

homu commented Dec 4, 2015

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

@Serabe
Copy link
Member Author

Serabe commented Dec 4, 2015

@homu, thank you. I'll be rebasing master soon, though I'll try to squash the commits so far (the conflict happens in closure_component_test.js and I hope that that is only because of 3477995, that gets mostly reverted in 9a9eab5)

@Serabe Serabe force-pushed the feature/contextual-glimmer-components branch from 9a9eab5 to 6c4b264 Compare December 4, 2015 21:56
Serabe added a commit to Serabe/htmlbars that referenced this pull request Dec 10, 2015
HTMLBars need to be able to generate components with syntax `my.comp` for
implementing contexual components.

emberjs/ember.js#12617
Serabe added a commit to Serabe/htmlbars that referenced this pull request Dec 10, 2015
HTMLBars need to be able to generate components with syntax `my.comp` for
implementing contexual components.

emberjs/ember.js#12617
@Serabe
Copy link
Member Author

Serabe commented Dec 10, 2015

This PR needs tildeio/htmlbars#438 due to <my.component> being compiled to the fragment part.

@Serabe Serabe force-pushed the feature/contextual-glimmer-components branch from 6c4b264 to d80ac03 Compare December 11, 2015 12:49
@rwjblue
Copy link
Member

rwjblue commented Dec 11, 2015

@Serabe - Can you updated package.json and npm-shrinkwrap.json to use htmlbars@0.14.10 (manually apply the same changes as #12705 for the version you need)?

@Serabe
Copy link
Member Author

Serabe commented Dec 12, 2015

Yes. I'll upload a PR tomorrow morning for this. I'm not uploading this tonight cause npm is taking longer than usual and I cannot check the tests 😞

@Serabe
Copy link
Member Author

Serabe commented Dec 12, 2015

@rwjblue I have uploaded PR #12706. I cannot install the dependencies using the npm shrinkwrap file, though I can install them without it. Cannot check in a different network until Monday.

@rwjblue
Copy link
Member

rwjblue commented Dec 12, 2015 via email

@Serabe
Copy link
Member Author

Serabe commented Dec 13, 2015

Adding some tests and then I'll remove the autounboxing feature. With the new requirements it is not needed.

@Serabe Serabe force-pushed the feature/contextual-glimmer-components branch 2 times, most recently from a04b764 to e9c46f5 Compare December 13, 2015 21:59
@Serabe Serabe changed the title [WIP] [BUGFIX canary] Allow contextual components to be a glimmer component [BUGFIX canary] Allow contextual components to be a glimmer component Dec 13, 2015
@homu
Copy link
Contributor

homu commented Dec 21, 2015

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

@Serabe Serabe force-pushed the feature/contextual-glimmer-components branch from e9c46f5 to 9684049 Compare December 21, 2015 00:34
@Serabe
Copy link
Member Author

Serabe commented Dec 21, 2015

Rebased!

@homu
Copy link
Contributor

homu commented Dec 22, 2015

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

Example:

```hbs
<my-form model=model as |f|>
  <f.button name='firstName' />
  <f.submit>Save</f.submit>
</my-form>
```
@Serabe Serabe force-pushed the feature/contextual-glimmer-components branch from 9684049 to a6e377b Compare December 23, 2015 00:09
@homu
Copy link
Contributor

homu commented Mar 13, 2016

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

@rwjblue
Copy link
Member

rwjblue commented Apr 10, 2016

I'm not sure of the path forward on this. We should likely let the dust settle on the glimmer integration efforts and attack again....

@Serabe Serabe changed the title [BUGFIX canary] Allow contextual components to be a glimmer component [WIP] [BUGFIX canary] Allow contextual components to be a glimmer component Apr 11, 2016
@rwjblue
Copy link
Member

rwjblue commented Sep 27, 2016

Thanks so much for working on this @Serabe, but since we did a full migration to ember-glimmer and removed support for angle bracket components I am going to close this PR.

I am sure we will work together on this again when we get angle bracket components going again...

@rwjblue rwjblue closed this Sep 27, 2016
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

Successfully merging this pull request may close these issues.

Angle components can't be rendered using the {{component}} helper
4 participants