diff --git a/src/stores/mapPathStore.ts b/src/stores/mapPathStore.ts index 8ff51a0..6c2af8c 100644 --- a/src/stores/mapPathStore.ts +++ b/src/stores/mapPathStore.ts @@ -224,10 +224,13 @@ export const useMapPathStore = defineStore('mapPathStore', { return false; // Return false when the current node does not match }, highlightClickedPath(clickedActiveTraceIndex: number, clickedPathListIndex: number) { - this.insightWithPath[INSIGHTS_FIELDS_AND_LABELS[clickedActiveTraceIndex][0]][clickedPathListIndex].edges.forEach(edgeToHighlight => { + const key = INSIGHTS_FIELDS_AND_LABELS[clickedActiveTraceIndex]?.[0]; + const path = this.insightWithPath?.[key]?.[clickedPathListIndex]; + if (!path) return; + path.edges.forEach(edgeToHighlight => { edgeToHighlight.addClass('highlight-edge'); }); - this.insightWithPath[INSIGHTS_FIELDS_AND_LABELS[clickedActiveTraceIndex][0]][clickedPathListIndex].nodes.forEach(nodeToHighlight => { + path.nodes.forEach(nodeToHighlight => { nodeToHighlight.data('nodeImageUrl', ImgCapsulesGlow[nodeToHighlight.data('level')]); }); },