refactor(state): separate nodes and edges
This commit is contained in:
@@ -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>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user