fix(useNodesData): fix crash when passing invalid node id

This commit is contained in:
saswata
2024-03-09 15:43:37 +05:30
parent 09118c1c8e
commit 7104872a12

View File

@@ -2,7 +2,11 @@ import { NodeBase } from '../types';
type NodeData = Pick<NodeBase, 'id' | 'type' | 'data'>;
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];