From 2134383b5abc5dd8bc4cfe8ec458249f2aab01e7 Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Tue, 28 Apr 2026 23:36:09 +0200 Subject: [PATCH] fix: guard placeholders with Array.isArray to prevent e.filter crash Same pattern as the email templates variables fix. Backend may return placeholders as object instead of array. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../app/sdk/document-generator/_components/GeneratorSection.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-compliance/app/sdk/document-generator/_components/GeneratorSection.tsx b/admin-compliance/app/sdk/document-generator/_components/GeneratorSection.tsx index 7b27996..01a722c 100644 --- a/admin-compliance/app/sdk/document-generator/_components/GeneratorSection.tsx +++ b/admin-compliance/app/sdk/document-generator/_components/GeneratorSection.tsx @@ -38,7 +38,7 @@ export default function GeneratorSection({ const [activeTab, setActiveTab] = useState<'placeholders' | 'preview'>('placeholders') const [expandedSections, setExpandedSections] = useState>(new Set(['PROVIDER', 'LEGAL'])) - const placeholders = template.placeholders || [] + const placeholders = Array.isArray(template.placeholders) ? template.placeholders : [] const relevantSections = useMemo(() => getRelevantSections(placeholders), [placeholders]) const uncovered = useMemo(() => getUncoveredPlaceholders(placeholders, context), [placeholders, context]) const missing = useMemo(() => getMissingRequired(placeholders, context), [placeholders, context])