From fc2acc2c535822ded29cd8c11fde1a342c85870f Mon Sep 17 00:00:00 2001 From: twwu Date: Tue, 27 Jan 2026 21:58:15 +0800 Subject: [PATCH] refactor(form): streamline error handling by removing redundant expired state management --- web/app/(humanInputLayout)/form/[token]/form.tsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/web/app/(humanInputLayout)/form/[token]/form.tsx b/web/app/(humanInputLayout)/form/[token]/form.tsx index 784084fdeb..23263a8f2e 100644 --- a/web/app/(humanInputLayout)/form/[token]/form.tsx +++ b/web/app/(humanInputLayout)/form/[token]/form.tsx @@ -41,12 +41,12 @@ const FormContent = () => { const [inputs, setInputs] = useState>({}) const [success, setSuccess] = useState(false) - const [expired, setExpired] = useState(false) const { mutate: submitForm, isPending: isSubmitting } = useSubmitHumanInputForm() const { data: formData, isLoading, error } = useGetHumanInputForm(token) + const expired = (error as HumanInputFormError | null)?.code === 'human_input_form_expired' const submitted = (error as HumanInputFormError | null)?.code === 'human_input_form_submitted' const splitByOutputVar = (content: string): string[] => { @@ -86,14 +86,6 @@ const FormContent = () => { onSuccess: () => { setSuccess(true) }, - onError: async (error) => { - if (error instanceof Response && error.status && error.json) { - const errorData = await error.json() as { code: string, message: string } - if (errorData.code === 'human_input_form_expired') { - setExpired(true) - } - } - }, }, ) }