Skip to content

Commit

Permalink
correct-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfauquette committed Nov 14, 2024
1 parent a070ed6 commit adec5bf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/x-charts/src/internals/useStore.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down

0 comments on commit adec5bf

Please sign in to comment.