lifeart / ember-ast-hot-load

Universal hot-load addon for Ember applications. Support classic/pods/mu layouts and route templates reloading.
MIT License
91 stars 17 forks source link

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

Closed nwhittaker closed 2 years ago

nwhittaker commented 2 years ago

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 https://github.com/lifeart/ember-ast-hot-load/compare/master...nwhittaker:block-params.

lifeart commented 2 years ago

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: https://github.com/emberjs/ember.js/pull/17146 https://github.com/emberjs/ember.js/pull/17160 https://github.com/glimmerjs/glimmer-vm/pull/892

Could you try test https://github.com/lifeart/ember-ast-hot-load/issues/716?

nwhittaker commented 2 years ago

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

lifeart commented 2 years ago

@nwhittaker thank you for testing!

ember-ast-hot-load@3.0.1 published