From 7104872a12ab2840c4ba545fe6a23de06ee192a0 Mon Sep 17 00:00:00 2001 From: saswata <125185423+saswatax@users.noreply.github.com> Date: Sat, 9 Mar 2024 15:43:37 +0530 Subject: [PATCH] fix(useNodesData): fix crash when passing invalid node id --- packages/system/src/utils/shallow-node-data.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/system/src/utils/shallow-node-data.ts b/packages/system/src/utils/shallow-node-data.ts index 2faf1c1a..42af404e 100644 --- a/packages/system/src/utils/shallow-node-data.ts +++ b/packages/system/src/utils/shallow-node-data.ts @@ -2,7 +2,11 @@ import { NodeBase } from '../types'; type NodeData = Pick; -export function shallowNodeData(a: NodeData | NodeData[], b: NodeData | NodeData[]) { +export function shallowNodeData(a: NodeData | null | NodeData[], b: NodeData | null | NodeData[]) { + if (a === null || b === null) { + return false; + } + const _a = Array.isArray(a) ? a : [a]; const _b = Array.isArray(b) ? b : [b];