From 06e962c7ce075f53f9bbc5aa26bb4025b9b351cc Mon Sep 17 00:00:00 2001 From: Tom Wheeler Date: Tue, 17 Mar 2026 20:13:54 +1300 Subject: [PATCH] fix(multi-source): reset stale title template when changing from single to multi source fix #521 --- .../Collections/FormSections/TemplateSection.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/Collections/FormSections/TemplateSection.tsx b/src/components/Collections/FormSections/TemplateSection.tsx index 9c46ca7..22c593f 100644 --- a/src/components/Collections/FormSections/TemplateSection.tsx +++ b/src/components/Collections/FormSections/TemplateSection.tsx @@ -147,9 +147,13 @@ const TemplateSection = ({ detectedMediaTypes ); - // Auto-select the first available option if template is empty - // This ensures validation passes on initial render - if (!values.template && templatePresets.length > 0) { + // Auto-select the first available option if template is empty or not in current presets + // This handles cases like editing a multi-source collection that was previously + // single-source (e.g., template = 'Trending Anime' but multi-source only has 'custom') + const isTemplateValid = + values.template && + templatePresets.some((p) => p.value === values.template); + if (!isTemplateValid && templatePresets.length > 0) { setFieldValue('template', templatePresets[0].value); }