fix(tests) adjusted FlowConfig type
This commit is contained in:
Vendored
+5
-5
@@ -2,10 +2,10 @@ import { BackgroundProps, ControlProps, Edge, MiniMapProps, Node, PanelProps, Re
|
||||
|
||||
declare global {
|
||||
interface FlowConfig {
|
||||
flowProps: Omit<ReactFlowProps, 'nodes' | 'edges'> & { nodes: Node[]; edges: Edge[] };
|
||||
panelProps: PanelProps;
|
||||
backgroundProps: BackgroundProps;
|
||||
controlsProps: ControlProps;
|
||||
minimapProps: MiniMapProps;
|
||||
flowProps?: Omit<ReactFlowProps, 'nodes' | 'edges'> & { nodes: Node[]; edges: Edge[] };
|
||||
panelProps?: PanelProps;
|
||||
backgroundProps?: BackgroundProps;
|
||||
controlsProps?: ControlProps;
|
||||
minimapProps?: MiniMapProps;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ type FlowProps = {
|
||||
};
|
||||
|
||||
export default ({ flowConfig }: FlowProps) => {
|
||||
const [nodes, setNodes] = useState(flowConfig.flowProps.nodes);
|
||||
const [edges, setEdges] = useState(flowConfig.flowProps.edges);
|
||||
const [nodes, setNodes] = useState(flowConfig.flowProps?.nodes);
|
||||
const [edges, setEdges] = useState(flowConfig.flowProps?.edges);
|
||||
const props = { ...flowConfig.flowProps, nodes, edges };
|
||||
|
||||
const onNodesChange: OnNodesChange = useCallback((changes) => setNodes((nds) => applyNodeChanges(changes, nds)), []);
|
||||
|
||||
Vendored
+5
-5
@@ -20,11 +20,11 @@ declare global {
|
||||
}
|
||||
|
||||
interface FlowConfig {
|
||||
flowProps: Omit<SvelteFlowProps, 'nodes' | 'edges'> & { nodes: Node[]; edges: Edge[] };
|
||||
panelProps: PanelProps;
|
||||
backgroundProps: BackgroundProps;
|
||||
controlsProps: ControlsProps;
|
||||
minimapProps: MiniMapProps;
|
||||
flowProps?: Omit<SvelteFlowProps, 'nodes' | 'edges'> & { nodes: Node[]; edges: Edge[] };
|
||||
panelProps?: PanelProps;
|
||||
backgroundProps?: BackgroundProps;
|
||||
controlsProps?: ControlsProps;
|
||||
minimapProps?: MiniMapProps;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
export let flowConfig: FlowConfig;
|
||||
|
||||
// Create writables here so it is easier to create test cases
|
||||
const nodes = writable(flowConfig.flowProps.nodes);
|
||||
const edges = writable(flowConfig.flowProps.edges);
|
||||
const nodes = writable(flowConfig.flowProps?.nodes);
|
||||
const edges = writable(flowConfig.flowProps?.edges);
|
||||
|
||||
const flowProps = { ...flowConfig.flowProps, nodes, edges };
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user