From b7b1ace1c07f72533132b22711af43c457f3f245 Mon Sep 17 00:00:00 2001 From: Marek Vesely <xvesely4@fi.muni.cz> Date: Thu, 16 May 2024 16:49:20 +0200 Subject: [PATCH] docs: document the discard draft function properly --- frontend/src/email/EmailForm/useFormState.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/email/EmailForm/useFormState.ts b/frontend/src/email/EmailForm/useFormState.ts index d45bea19e..7ce480870 100644 --- a/frontend/src/email/EmailForm/useFormState.ts +++ b/frontend/src/email/EmailForm/useFormState.ts @@ -184,6 +184,11 @@ const useFormState = ({ }) } + /** + * Resets the form state to the initial state. If the form was loaded from + * a draft, the draft will be discarded + * (currently, that means updating its values to the initial values). + */ const discardDraft = (notifyOnSuccess: boolean) => { setSenderAddress(teamAddress || '') setContent('') @@ -195,6 +200,7 @@ const useFormState = ({ setTemplate(undefined) if (!loadDraft) { + notify('Draft discarded') return } -- GitLab