fix(useNodesData): fix crash when passing invalid node id
This commit is contained in:
@@ -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];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user