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

Yielded component not resolved when ...attributes exists #716

Closed
nwhittaker opened this issue Feb 15, 2022 · 3 comments · Fixed by #717
Closed

Yielded component not resolved when ...attributes exists #716

nwhittaker opened this issue Feb 15, 2022 · 3 comments · Fixed by #717

Comments

@nwhittaker
Copy link
Contributor

nwhittaker commented Feb 15, 2022

I noticed a somewhat convoluted issue where a yielded component is not rendered when combined with ...attributes.

Given a component that yields a component:

{{!-- angle-block-params.hbs --}}

{{!-- This container may not be strictly necessary, but gives `...attributes` a place to land. --}}
<div ...attributes>
  {{yield (component "x-test-wrapper")}}
</div>

And invoking it:

<AngleBlockParams ...attributes as |BlockParam|>
  <BlockParam />
</AngleBlockParams>

Outputs the static string BlockParam instead of the usual list of numbers that x-test-wrapper produces.

Interestingly, invoking it without ...attributes or adopting the curly-component syntax produces the expected behavior:

<AngleBlockParams as |BlockParam|>
  <BlockParam />
</AngleBlockParams>
<AngleBlockParams ...attributes as |BlockParam|>
  {{BlockParam}}
</AngleBlockParams>

The expected behavior also occurs if ember-ast-hot-load.enabled=false is set in ember-cli-build.js, so the issue does appear to be caused by this addon.

I have a branch with sample code that produces the problem at master...nwhittaker:block-params.

@lifeart
Copy link
Owner

lifeart commented Feb 16, 2022

Hi @nwhittaker! Thank you for report and reproduction!
It may be related to this lines: https://github.com/lifeart/ember-ast-hot-load/blob/master/lib/ast-transform.js#L316

Related PR's:
emberjs/ember.js#17146
emberjs/ember.js#17160
glimmerjs/glimmer-vm#892

Could you try test #716?

@nwhittaker
Copy link
Contributor Author

I tested my sample on top of #717 and it did appear to resolve the issue, thanks!

@lifeart
Copy link
Owner

lifeart commented Feb 16, 2022

@nwhittaker thank you for testing!

ember-ast-hot-load@3.0.1 published

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 a pull request may close this issue.

2 participants