From 89e9ab6bcca15af98e4d7cbd0172406433d612b2 Mon Sep 17 00:00:00 2001 From: Brian Ingles Date: Fri, 8 Dec 2023 12:59:22 -0600 Subject: [PATCH] Added comment #1540 --- packages/components/src/RandomAreaPlotAnimation.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/components/src/RandomAreaPlotAnimation.tsx b/packages/components/src/RandomAreaPlotAnimation.tsx index de4993856..85bd75ef3 100644 --- a/packages/components/src/RandomAreaPlotAnimation.tsx +++ b/packages/components/src/RandomAreaPlotAnimation.tsx @@ -44,6 +44,9 @@ const RandomAreaPlotAnimation = React.memo(() => { const [themeColors, setThemeColors] = useState(null); + // Resolving css variables has to run in `useEffect` or `useLayoutEffect` so + // that we know React has updated the DOM with any styles set by the + // ThemeProvider. useEffect(() => { setThemeColors(getRandomAreaPlotAnimationThemeColors()); }, [activeThemes]);