From 284a3b27b9d9208527513b537040fc24f5cac567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Frnka?= Date: Fri, 18 Sep 2026 15:45:02 +0200 Subject: [PATCH] Added keys to avoid re-drawing when redraw should on happen and redraw when templates are switched --- plugin/src/components/CustomTemplateSection.tsx | 8 -------- plugin/src/components/TemplateManager.tsx | 1 + plugin/src/components/settings/TenantTemplateSettings.tsx | 1 + 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/plugin/src/components/CustomTemplateSection.tsx b/plugin/src/components/CustomTemplateSection.tsx index b34842c..387b9d3 100644 --- a/plugin/src/components/CustomTemplateSection.tsx +++ b/plugin/src/components/CustomTemplateSection.tsx @@ -40,14 +40,6 @@ export function CustomTemplateSection({ const previousFileNameRef = useRef(fileName) const dragDepthRef = useRef(0) - // Reset the form whenever we switch which template is being edited (or created). - useEffect(() => { - setTitle(editingTemplate?.title ?? '') - setJson(editingTemplate ? JSON.stringify(editingTemplate.content, null, 2) : '') - setFileName('') - setInputMode('visual') - }, [editingTemplate]) - const processTemplateFile = async (file: File) => { try { const content = await file.text() diff --git a/plugin/src/components/TemplateManager.tsx b/plugin/src/components/TemplateManager.tsx index 791c920..a07294a 100644 --- a/plugin/src/components/TemplateManager.tsx +++ b/plugin/src/components/TemplateManager.tsx @@ -228,6 +228,7 @@ export function TemplateManager({ {isEditingSelected && detail ? (