From adec5bfdd48569515fd28525dcc7f24f0b64516e Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 14 Nov 2024 10:41:36 +0100 Subject: [PATCH] correct-fix --- packages/x-charts/src/internals/useStore.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/x-charts/src/internals/useStore.ts b/packages/x-charts/src/internals/useStore.ts index fe35081ef56c..f218a6226951 100644 --- a/packages/x-charts/src/internals/useStore.ts +++ b/packages/x-charts/src/internals/useStore.ts @@ -1,15 +1,16 @@ import * as React from 'react'; import { ChartsContext } from '../context/InteractionProvider'; +import { ChartsStore } from './plugins/utils/ChartsStore'; -export function useStore(skip?: boolean) { +export function useStore(skipError?: boolean): ChartsStore { const charts = React.useContext(ChartsContext); - if (skip === undefined) { + if (skipError) { // This line is only for `useAxisEvents` which is in the surface of the Gauge. // But the Gauge don't have store yet because it does not need the interaction provider. // Will be fixed when every thing move to the store since every component will have access to it. // @ts-ignore - return charts.store; + return charts?.store; } if (!charts) { throw new Error(