diff --git a/packages/core/src/components/popover/tooltipContext.tsx b/packages/core/src/components/popover/tooltipContext.tsx index 6eb990a0ed..1d0c43c389 100644 --- a/packages/core/src/components/popover/tooltipContext.tsx +++ b/packages/core/src/components/popover/tooltipContext.tsx @@ -23,7 +23,7 @@ export interface TooltipContextState { type TooltipAction = { type: "FORCE_DISABLED_STATE" } | { type: "RESET_DISABLED_STATE" }; const noOpDispatch: React.Dispatch = () => null; -export const TooltipContext = React.createContext<[TooltipContextState, React.Dispatch]>([ +export const TooltipContext = React.createContext]>([ {}, noOpDispatch, ]); @@ -46,6 +46,7 @@ interface TooltipProviderProps { export const TooltipProvider = ({ children, forceDisable }: TooltipProviderProps) => { const [state, dispatch] = React.useReducer(tooltipContextReducer, {}); + const contextValue = React.useMemo(() => [state, dispatch] as const, [state, dispatch]); React.useEffect(() => { if (forceDisable) { @@ -56,7 +57,7 @@ export const TooltipProvider = ({ children, forceDisable }: TooltipProviderProps }, [forceDisable]); return ( - + {typeof children === "function" ? children(state) : children} );