diff --git a/packages/dnb-design-system-portal/src/core/ChangeStyleTheme.tsx b/packages/dnb-design-system-portal/src/core/ChangeStyleTheme.tsx index f745cb1fc13..25d922c6839 100644 --- a/packages/dnb-design-system-portal/src/core/ChangeStyleTheme.tsx +++ b/packages/dnb-design-system-portal/src/core/ChangeStyleTheme.tsx @@ -9,9 +9,15 @@ import { export default function ChangeStyleTheme({ label = null } = {}) { const themes = getThemes() - const { name } = getTheme() const { update } = React.useContext(Context) + const [themeName, setThemeName] = React.useState(null) + + React.useEffect(() => { + const { name } = getTheme() + setThemeName(name) + }, []) + const date = Object.entries(themes).reduce((acc, [key, value]) => { if (!value?.hide) { acc[key] = capitalizeFirstLetter(value.name) @@ -22,7 +28,7 @@ export default function ChangeStyleTheme({ label = null } = {}) { return ( {