Skip to content

Commit 94bc2ab

Browse files
committed
FIO-9944: Fixes an issue where some form instances will not be destroyed
1 parent 52bed4a commit 94bc2ab

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/Form.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,12 @@ export const Form = (props: FormProps) => {
319319
if (formReadyCallback) {
320320
formReadyCallback(instance);
321321
}
322-
setFormInstance(instance);
322+
setFormInstance((prevInstance: any) => {
323+
if (prevInstance) {
324+
prevInstance.destroy(true);
325+
}
326+
return instance;
327+
});
323328
} else {
324329
console.warn('Failed to create form instance');
325330
}

0 commit comments

Comments
 (0)