diff --git a/projects/ng-devtools-backend/src/lib/client-event-subscribers.ts b/projects/ng-devtools-backend/src/lib/client-event-subscribers.ts index 9b8bb727fdf..cc219e8d4e7 100644 --- a/projects/ng-devtools-backend/src/lib/client-event-subscribers.ts +++ b/projects/ng-devtools-backend/src/lib/client-event-subscribers.ts @@ -83,6 +83,7 @@ const stopProfilingCallback = (messageBus: MessageBus) => () => { }; const selectedComponentCallback = (position: ElementPosition) => { + // TODO: figure out proper typing of the node variable. const node = queryDirectiveForest(position, getDirectiveForest()); setConsoleReference(node); }; diff --git a/projects/ng-devtools-backend/src/lib/component-tree.ts b/projects/ng-devtools-backend/src/lib/component-tree.ts index f49e69b4b00..d31faf2ae5d 100644 --- a/projects/ng-devtools-backend/src/lib/component-tree.ts +++ b/projects/ng-devtools-backend/src/lib/component-tree.ts @@ -27,7 +27,7 @@ export interface ComponentInstanceType { export interface ComponentTreeNode extends DevToolsNode { children: ComponentTreeNode[]; - position: ElementPosition; + position?: ElementPosition; } export const getLatestComponentState = (query: ComponentExplorerViewQuery): DirectivesProperties | undefined => { diff --git a/projects/ng-devtools-backend/src/lib/selected-component.ts b/projects/ng-devtools-backend/src/lib/selected-component.ts index 06c019950bd..6653e6f80cd 100644 --- a/projects/ng-devtools-backend/src/lib/selected-component.ts +++ b/projects/ng-devtools-backend/src/lib/selected-component.ts @@ -23,8 +23,8 @@ const _setConsoleReference = (node: ComponentTreeNode) => { }; const prepareCurrentReferencesForInsertion = (node: ComponentTreeNode) => { - const foundIndex = nodesForConsoleReference.findIndex(nodeToLookFor => - arrayEquals(nodeToLookFor.position, node.position) + const foundIndex = nodesForConsoleReference.findIndex( + nodeToLookFor => nodeToLookFor.position && node.position && arrayEquals(nodeToLookFor.position, node.position) ); if (foundIndex !== -1) { nodesForConsoleReference.splice(foundIndex, 1);