diff --git a/src/Tool.tsx b/src/Tool.tsx index a28a3dfc..959da51a 100644 --- a/src/Tool.tsx +++ b/src/Tool.tsx @@ -177,8 +177,13 @@ export const DarkMode = ({ api }: DarkModeProps) => { /** When storybook params change update the stored themes */ React.useEffect(() => { const currentStore = store(); - - updateStore({ ...currentStore, ...darkModeParams }); + // Ensure we use the stores `current` value first to persist + // themeing between page loads and story changes. + updateStore({ + ...currentStore, + ...darkModeParams, + current: currentStore.current || darkModeParams.current, + }); renderTheme() }, [darkModeParams, renderTheme])