refactor(state): separate nodes and edges

This commit is contained in:
moklick
2021-10-19 11:09:49 +02:00
parent 3dc79276ad
commit 410b12946d
22 changed files with 634 additions and 537 deletions
+12 -15
View File
@@ -1,24 +1,21 @@
import React, { FC } from 'react';
import { Provider, createStore } from '../../store';
// import { ReactFlowState } from '../../types';
// const reactFlowVersionSelector = (s: ReactFlowState) => s.reactFlowVersion;
import { Provider, createStore, useStoreApi } from '../../store';
const Wrapper: FC = ({ children }) => {
// let isWrapped = useRef<boolean>(true);
let isWrapped = true;
// try {
// useStoreApi();
// } catch {
// isWrapped.current = false;
// }
try {
useStoreApi();
} catch (e) {
isWrapped = false;
}
// if (isWrapped) {
// // we need to wrap it with a fragment because it's not allowed for children to be a ReactNode
// // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051
// return <>{children}</>;
// }
if (isWrapped) {
// we need to wrap it with a fragment because it's not allowed for children to be a ReactNode
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051
return <>{children}</>;
}
return <Provider createStore={createStore}>{children}</Provider>;
};