ember-cli / ember-cli/ember-template-imports

Proxying components causes template to not render

Open
#243 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
77
Forks
41
PR merge metrics
No merged PRs in 30d

Description

With a co-located component it's possible to proxy the component and everything works as it should.

```js
import Component from '@glimmer/component';

class MyComponent extends Component {
world = 'World';
}

const ProxiedComponent = new Proxy(MyComponent, {});

export default ProxiedComponent;
```

When using a template tag, the template fails to render, no errors are logged.

```glimmer-js
import Component from "@glimmer/component";

class MyComponent extends Component {
world = "World";

Hello {{this.world}}

}

const ProxiedComponent = new Proxy(MyComponent, {});

export default ProxiedComponent;
```

In the generated code for the colocated component the setComponentTemplate is applied to the proxy.

```js
export default setComponentTemplate(TEMPLATE, ProxiedComponent);
```

This doesn't appear to be the case for a template tag component.

```js
static {
setComponentTemplate(createTemplateFactory(
/*


Tests {{this.count}}


Click me


*/
{
"id": "Hg3FL3Xg",
"block": "[[[1,\"\\n \"],[10,0],[15,0,[30,0,[\"classList\"]]],[12],[1,\"\\n \"],[10,\"h1\"],[12],[1,\"Tests \"],[1,[30,0,[\"count\"]]],[13],[1,\"\\n \"],[11,\"button\"],[24,4,\"button\"],[4,[32,0,[\"on\"]],[\"click\",[30,0,[\"handleClick\"]]],null],[12],[1,\"Click me\"],[13],[1,\"\\n \"],[13],[1,\"\\n \"]],[],false,[]]",
"moduleName": "/Users/liam/Work/ember-vite/my-fancy-app/app/components/my-component.gjs",
"scope": () => [template__imports__],
"isStrictMode": true
}), this);
}
```

Reproduction repo https://github.com/evoactivity/ember-proxy-template-tag/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.