Skip to content

Commit

Permalink
chore: fix charts theme not updating in app
Browse files Browse the repository at this point in the history
  • Loading branch information
MEsteves22 committed Apr 5, 2024
1 parent d1f0a3b commit c312281
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/app/src/pages/layout/navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useMemo } from "react";
import { Outlet } from "react-router-dom";
import { HvProvider, useTheme } from "@hitachivantara/uikit-react-core";

Expand All @@ -24,6 +25,13 @@ const Navigation = () => {
setCurrentStep,
} = useGeneratorContext();

// Hack to update the charts theme
const theme = useMemo(() => {
const cusTheme = structuredClone(customTheme);
cusTheme.name = Math.random().toString();
return cusTheme;
}, [customTheme]);

return (
<div
id="gen-root"
Expand All @@ -33,7 +41,7 @@ const Navigation = () => {
classNameKey="gen-root"
rootElementId="gen-root"
cssTheme="scoped"
themes={[customTheme]}
themes={[theme]}
colorMode={selectedMode}
cssBaseline="none" // the main provider already applies the baseline styles globally
>
Expand Down

0 comments on commit c312281

Please sign in to comment.