From 2e0e7290badbc73ceb6db8a92444af3a2bc325ed Mon Sep 17 00:00:00 2001 From: Schalli Date: Wed, 1 Jul 2026 13:01:03 +0200 Subject: [PATCH] fix(calendar): remove setState call from render in isFormValid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit validateUrl() calls setUrlError() — calling it during render triggers React error #301 (cannot update component while rendering). Remove it from the isFormValid computation; onChange/onBlur already keep urlError in sync so !urlError is sufficient. Co-Authored-By: Claude Sonnet 4.6 --- apps/web/src/components/settings/calendar-source-form.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/settings/calendar-source-form.tsx b/apps/web/src/components/settings/calendar-source-form.tsx index 234324c..378d92a 100644 --- a/apps/web/src/components/settings/calendar-source-form.tsx +++ b/apps/web/src/components/settings/calendar-source-form.tsx @@ -94,13 +94,14 @@ export function CalendarSourceForm({ } }, [t]); - // Form is valid when name, type, and url are filled and url is https + // Form is valid when name, type, and url are filled and url passed validation. + // Do NOT call validateUrl here — it calls setUrlError which is a state update + // during render (React error #301). onChange/onBlur already set urlError. const isFormValid = name.trim() !== '' && type !== '' && url.trim() !== '' && - !urlError && - validateUrl(url); + !urlError; const handleSubmit = useCallback( async (e: React.FormEvent) => {