DEV: Use template-only for RenderGlimmer helper (#20138)

We don't need a full glimmer component here - the class definition was empty. We can use templateOnly() for slightly improved performance.

Setting `component.name` improves how MountWidget is displayed for debugging in the Ember Inspector browser extension.
This commit is contained in:
David Taylor 2023-02-02 09:52:44 +00:00 committed by GitHub
parent ce531913a8
commit c8f4a2cfb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import Component from "@glimmer/component"; import templateOnly from "@ember/component/template-only";
import { setComponentTemplate } from "@ember/component"; import { setComponentTemplate } from "@ember/component";
import { tracked } from "@glimmer/tracking"; import { tracked } from "@glimmer/tracking";
import { assert } from "@ember/debug"; import { assert } from "@ember/debug";
@ -129,7 +129,8 @@ export default class RenderGlimmer {
connectComponent() { connectComponent() {
const { element, template, widget } = this; const { element, template, widget } = this;
const component = class extends Component {}; const component = templateOnly();
component.name = "Widgets/RenderGlimmer";
setComponentTemplate(template, component); setComponentTemplate(template, component);
this._componentInfo = { this._componentInfo = {