Archived
Add business logo branding support
This commit is contained in:
@@ -63,15 +63,13 @@ export function AppearanceProvider({
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const [colorMode, setColorMode] = useState<ColorMode>(defaultColorMode);
|
||||
|
||||
useEffect(() => {
|
||||
const stored = readStoredColorMode();
|
||||
if (stored) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
setColorMode(stored);
|
||||
}
|
||||
}, []);
|
||||
// Lazy initializer so the first render already matches what the inline
|
||||
// appearance-init script set on <html> — a separate mount effect here
|
||||
// would run one render behind it, transiently flashing (and persisting)
|
||||
// colorMode back to the default before the effect's own state update lands.
|
||||
const [colorMode, setColorMode] = useState<ColorMode>(
|
||||
() => readStoredColorMode() ?? defaultColorMode,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
applyColorMode(colorMode);
|
||||
|
||||
Reference in New Issue
Block a user