From 22db82c8b8ab7d9feeb20fdedc6b50bb7479af4c Mon Sep 17 00:00:00 2001 From: moklick Date: Fri, 25 Nov 2022 22:03:48 +0100 Subject: [PATCH] chore(wrapper): cleanup --- packages/core/src/container/ReactFlow/Wrapper.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/core/src/container/ReactFlow/Wrapper.tsx b/packages/core/src/container/ReactFlow/Wrapper.tsx index b6069948..f0f56d24 100644 --- a/packages/core/src/container/ReactFlow/Wrapper.tsx +++ b/packages/core/src/container/ReactFlow/Wrapper.tsx @@ -1,10 +1,13 @@ -import { FC, PropsWithChildren, useContext } from 'react'; +import { useContext } from 'react'; +import type { FC, PropsWithChildren } from 'react'; import StoreContext from '../../contexts/RFStoreContext'; import ReactFlowProvider from '../../components/ReactFlowProvider'; const Wrapper: FC = ({ children }) => { - if (useContext(StoreContext)) { + const isWrapped = useContext(StoreContext); + + 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};