diff --git a/src/pages/VisProgPage/visualProgrammingUI/EditorWarnings.tsx b/src/pages/VisProgPage/visualProgrammingUI/EditorWarnings.tsx index 7ecde38..66c12b5 100644 --- a/src/pages/VisProgPage/visualProgrammingUI/EditorWarnings.tsx +++ b/src/pages/VisProgPage/visualProgrammingUI/EditorWarnings.tsx @@ -122,6 +122,26 @@ export function editorWarningRegistry(get: ZustandGet, set: ZustandSet) : Editor }) }, - unregisterWarningsForNode: (_nodeId) => {}, + unregisterWarningsForNode: (nodeId) => { + const wRegistry = get().editorWarningRegistry; + const sIndex = get().severityIndex; + + const nodeWarnings = wRegistry.get(nodeId); + + // remove from severity index + if (nodeWarnings) { + nodeWarnings.forEach((warning, warningKey) => { + sIndex.get(warning.severity)?.delete({nodeId, warningKey}); + }); + } + + // remove from registry + wRegistry.delete(nodeId); + + set({ + editorWarningRegistry: wRegistry, + severityIndex: sIndex + }) + }, }}