diff --git a/packages/x-charts/src/internals/useStore.ts b/packages/x-charts/src/internals/useStore.ts index fe35081ef56c1..99778bb9f5993 100644 --- a/packages/x-charts/src/internals/useStore.ts +++ b/packages/x-charts/src/internals/useStore.ts @@ -1,15 +1,15 @@ import * as React from 'react'; import { ChartsContext } from '../context/InteractionProvider'; -export function useStore(skip?: boolean) { +export function useStore(skipError?: boolean) { 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(