Skip to content

Commit 294fc88

Browse files
milomgcrisbeto
authored andcommitted
refactor(devtools): enable view source for template effects (#62692)
Use inspect(class instance.constructor) to jump to the source of components when trying to inspect template effects PR Close #62692
1 parent 12fe5f6 commit 294fc88

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/core/src/render3/util/signal_debug.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
import {assertTNode, assertLView} from '../assert';
1414
import {getFrameworkDIDebugData} from '../debug/framework_injector_profiler';
1515
import {NodeInjector, getNodeInjectorTNode, getNodeInjectorLView} from '../di';
16-
import {REACTIVE_TEMPLATE_CONSUMER, HOST, LView} from '../interfaces/view';
16+
import {REACTIVE_TEMPLATE_CONSUMER, HOST, LView, CONTEXT} from '../interfaces/view';
1717
import {EffectNode, EffectRefImpl, ROOT_EFFECT_NODE, VIEW_EFFECT_NODE} from '../reactivity/effect';
1818
import {Injector} from '../../di/injector';
1919
import {R3Injector} from '../../di/r3_injector';
@@ -133,6 +133,9 @@ function getNodesAndEdgesFromSignalMap(signalMap: ReadonlyMap<ReactiveNode, Reac
133133
label: consumer.debugName ?? consumer.lView?.[HOST]?.tagName?.toLowerCase?.(),
134134
kind: consumer.kind,
135135
epoch: consumer.version,
136+
// The `lView[CONTEXT]` is a reference to an instance of the component's class.
137+
// We get the constructor so that `inspect(.constructor)` shows the component class.
138+
debuggableFn: consumer.lView?.[CONTEXT]?.constructor as (() => unknown) | undefined,
136139
id,
137140
});
138141
} else {

0 commit comments

Comments
 (0)