fix(hooks): repair useStoreActions hook

This commit is contained in:
moklick
2021-01-21 19:35:04 +01:00
parent e9a7ade236
commit 252552a694
8 changed files with 63 additions and 37 deletions
+9 -12
View File
@@ -1,20 +1,17 @@
import React, { FC } from 'react';
import { Provider } from 'react-redux';
import React, { FC, useContext } from 'react';
import { Provider, ReactReduxContext } from 'react-redux';
import store from '../../store';
// import { useStore } from '../../store/hooks';
const Wrapper: FC = ({ children }) => {
// const reactFlowStore = useStore();
// const isWrapepdWithReactFlowProvider = reactFlowStore?.getState()?.reactFlowVersion;
const contextValue = useContext(ReactReduxContext);
const isWrappedWithReactFlowProvider = contextValue?.store?.getState()?.reactFlowVersion;
// console.log(isWrapepdWithReactFlowProvider);
// if (isWrapepdWithReactFlowProvider) {
// // we need to wrap it with a fragment because t's not allowed for children to be a ReactNode
// // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051
// return <>{children}</>;
// }
if (isWrappedWithReactFlowProvider) {
// we need to wrap it with a fragment because t's not allowed for children to be a ReactNode
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051
return <>{children}</>;
}
return <Provider store={store}>{children}</Provider>;
};