From 02fb71c0ff69d293911f4b0945ab964a87402d0c Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Mon, 15 May 2023 15:38:04 -0300
Subject: third form and placeholder for the next ones

---
 packages/exchange-backoffice-ui/src/handlers/FormProvider.tsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'packages/exchange-backoffice-ui/src/handlers/FormProvider.tsx')

diff --git a/packages/exchange-backoffice-ui/src/handlers/FormProvider.tsx b/packages/exchange-backoffice-ui/src/handlers/FormProvider.tsx
index 4019fbc89..4397fc197 100644
--- a/packages/exchange-backoffice-ui/src/handlers/FormProvider.tsx
+++ b/packages/exchange-backoffice-ui/src/handlers/FormProvider.tsx
@@ -1,6 +1,6 @@
 import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
 import { ComponentChildren, VNode, createContext, h } from "preact";
-import { MutableRef, StateUpdater, useRef } from "preact/hooks";
+import { MutableRef, StateUpdater, useEffect, useRef } from "preact/hooks";
 
 export interface FormType<T> {
   value: MutableRef<Partial<T>>;
@@ -49,6 +49,11 @@ export function FormProvider<T>({
   children: ComponentChildren;
 }): VNode {
   const value = useRef(initialValue ?? {});
+  useEffect(() => {
+    return function onUnload() {
+      value.current = {};
+    };
+  });
   return (
     <FormContext.Provider
       value={{ initialValue, value, onUpdate, computeFormState }}
-- 
cgit v1.2.3

