Skip to content

Commit e854358

Browse files
committed
Use deep merging for global context theme for consistency
1 parent f73515c commit e854358

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

projects/js-packages/charts/src/providers/chart-context/global-charts-provider.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { createContext, useCallback, useMemo, useState, useEffect, useRef } from 'react';
2+
import { mergeThemes } from '../../utils';
23
import { defaultTheme } from '../theme/themes';
34
import type { GlobalChartsContextValue, ChartRegistration } from './types';
45
import type { ChartTheme } from '../../types';
@@ -18,7 +19,7 @@ export const GlobalChartsProvider: FC< GlobalChartsProviderProps > = ( {
1819
} ) => {
1920
const [ charts, setCharts ] = useState< Map< string, ChartRegistration > >( () => new Map() );
2021

21-
const providerTheme: ChartTheme = useMemo( () => ( { ...defaultTheme, ...theme } ), [ theme ] );
22+
const providerTheme: ChartTheme = useMemo( () => mergeThemes( defaultTheme, theme ), [ theme ] );
2223

2324
// Stable group -> color mapping for this provider lifecycle
2425
const groupToColorMapRef = useRef< Map< string, string > >( new Map() );

0 commit comments

Comments
 (0)