From 94bc2ab497787f8f547bad299ac39d8ba4dfd89a Mon Sep 17 00:00:00 2001 From: KirylDrutsko Date: Mon, 26 May 2025 16:36:38 +0300 Subject: [PATCH] FIO-9944: Fixes an issue where some form instances will not be destroyed --- src/components/Form.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/Form.tsx b/src/components/Form.tsx index cb87afa37..52f5d6b5f 100644 --- a/src/components/Form.tsx +++ b/src/components/Form.tsx @@ -319,7 +319,12 @@ export const Form = (props: FormProps) => { if (formReadyCallback) { formReadyCallback(instance); } - setFormInstance(instance); + setFormInstance((prevInstance: any) => { + if (prevInstance) { + prevInstance.destroy(true); + } + return instance; + }); } else { console.warn('Failed to create form instance'); }