Skip to content

Commit df2068a

Browse files
NullVoxPopuliclaude
andcommitted
fix: use full invocation path for dynamic component debugRenderTree names
Use the full debugLabel as the component name so users see exactly how the component was invoked: - `<this.Foo>` → name: "this.Foo" - `<@Greeting>` → name: "@Greeting" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f4dc41a commit df2068a

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

packages/@glimmer-workspace/integration-tests/test/debug-render-tree-test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class DebugRenderTreeTest extends RenderTest {
165165

166166
this.assert.strictEqual(
167167
componentNode?.name,
168-
'HelloWorld',
168+
'this.HelloWorld',
169169
`dynamic <this.X> component name (got "${componentNode?.name}")`
170170
);
171171
}
@@ -185,10 +185,9 @@ class DebugRenderTreeTest extends RenderTest {
185185

186186
this.assert.ok(componentNode, 'found a component child node');
187187

188-
// For <@Greeting>, the invocation-site name "Greeting" is used
189188
this.assert.strictEqual(
190189
componentNode?.name,
191-
'Greeting',
190+
'@Greeting',
192191
`dynamic <@X> component name (got "${componentNode?.name}")`
193192
);
194193
}

packages/@glimmer/runtime/lib/compiled/opcodes/component.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ APPEND_OPCODES.add(VM_RESOLVE_DYNAMIC_COMPONENT_OP, (vm, { op1: _isStrict }) =>
186186
if (DEBUG && !isCurriedValue(definition) && !definition.resolvedName && !definition.debugName) {
187187
let debugLabel = ref.debugLabel;
188188
if (debugLabel) {
189-
// Extract the last segment of the path (e.g. "this.Foo" → "Foo", "Foo" → "Foo")
190-
definition.debugName = debugLabel.split('.').pop();
189+
definition.debugName = debugLabel;
191190
}
192191
}
193192

@@ -229,12 +228,7 @@ APPEND_OPCODES.add(VM_RESOLVE_CURRIED_COMPONENT_OP, (vm) => {
229228
if (DEBUG && definition && !isCurriedValue(definition) && !definition.resolvedName && !definition.debugName) {
230229
let debugLabel = ref.debugLabel;
231230
if (debugLabel) {
232-
// Extract the component name from the arg path (e.g. "@Greeting" → "Greeting")
233-
let name = debugLabel.split('.').pop()!;
234-
if (name.startsWith('@')) {
235-
name = name.slice(1);
236-
}
237-
definition.debugName = name;
231+
definition.debugName = debugLabel;
238232
}
239233
}
240234

0 commit comments

Comments
 (0)