Add bounds checks in highlightClickedPath to prevent undefined access
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -224,10 +224,13 @@ export const useMapPathStore = defineStore('mapPathStore', {
|
|||||||
return false; // Return false when the current node does not match
|
return false; // Return false when the current node does not match
|
||||||
},
|
},
|
||||||
highlightClickedPath(clickedActiveTraceIndex: number, clickedPathListIndex: number) {
|
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');
|
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')]);
|
nodeToHighlight.data('nodeImageUrl', ImgCapsulesGlow[nodeToHighlight.data('level')]);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user