chore(a11y): merge labelConfig with defaults

This commit is contained in:
Abbey Yacoe
2025-05-22 11:38:02 +02:00
parent 6081f687bf
commit 48c5467851
5 changed files with 15 additions and 5 deletions
@@ -5,7 +5,7 @@
*/
import { useEffect, useRef } from 'react';
import { shallow } from 'zustand/shallow';
import { infiniteExtent, type CoordinateExtent } from '@xyflow/system';
import { infiniteExtent, type CoordinateExtent, mergeLabelConfig, LabelConfig } from '@xyflow/system';
import { useStore, useStoreApi } from '../../hooks/useStore';
import type { Node, Edge, ReactFlowState, ReactFlowProps, FitViewOptions } from '../../types';
@@ -157,6 +157,10 @@ export function StoreUpdater<NodeType extends Node = Node, EdgeType extends Edge
// Renamed fields
else if (fieldName === 'fitView') store.setState({ fitViewQueued: fieldValue as boolean });
else if (fieldName === 'fitViewOptions') store.setState({ fitViewOptions: fieldValue as FitViewOptions });
if (fieldName === 'labelConfig') {
store.setState({ labelConfig: mergeLabelConfig(fieldValue as LabelConfig) });
}
// General case
else store.setState({ [fieldName]: fieldValue });
}