chore(react/svelte): rename nodes/edges to initialNodes/initialEdges for Provider comp

This commit is contained in:
moklick
2023-10-09 17:12:49 +02:00
parent afa6365e12
commit d062214536
3 changed files with 28 additions and 14 deletions
@@ -8,21 +8,26 @@ import type { ReactFlowState, Node, Edge } from '../../types';
function ReactFlowProvider({
children,
nodes,
edges,
width,
height,
initialNodes,
initialEdges,
initialWidth,
initialHeight,
}: {
children: ReactNode;
nodes?: Node[];
edges?: Edge[];
width?: number;
height?: number;
initialNodes?: Node[];
initialEdges?: Edge[];
initialWidth?: number;
initialHeight?: number;
}) {
const storeRef = useRef<UseBoundStoreWithEqualityFn<StoreApi<ReactFlowState>> | null>(null);
if (!storeRef.current) {
storeRef.current = createRFStore({ nodes, edges, width, height });
storeRef.current = createRFStore({
nodes: initialNodes,
edges: initialEdges,
width: initialWidth,
height: initialHeight,
});
}
return <Provider value={storeRef.current}>{children}</Provider>;