diff --git a/components/landing/comic-creation-form.tsx b/components/landing/comic-creation-form.tsx index 2204d2b..51648f0 100644 --- a/components/landing/comic-creation-form.tsx +++ b/components/landing/comic-creation-form.tsx @@ -51,14 +51,8 @@ export function ComicCreationForm({ const [creditsRemaining, setCreditsRemaining] = useState(null); const [showApiModal, setShowApiModal] = useState(false); - // Initialize style with saved preference or default - const [style, setStyle] = useState(() => { - if (typeof window !== 'undefined') { - const saved = localStorage.getItem(STYLE_STORAGE_KEY); - return saved || initialStyle || DEFAULT_STYLE; - } - return initialStyle || DEFAULT_STYLE; - }); + // Initialize style with initial value, load from localStorage after mount + const [style, setStyle] = useState(initialStyle || DEFAULT_STYLE); const fileInputRef = useRef(null); const textareaRef = useRef(null); @@ -93,6 +87,14 @@ export function ComicCreationForm({ } }, []); // Run only on mount + // Load style preference from localStorage on mount + useEffect(() => { + const saved = localStorage.getItem(STYLE_STORAGE_KEY); + if (saved) { + setStyle(saved); + } + }, []); + // Save style to localStorage and sync with parent useEffect(() => { localStorage.setItem(STYLE_STORAGE_KEY, style);