From ba8bfcb4f77e0d265aa03a85b0f0ff903ac657da Mon Sep 17 00:00:00 2001 From: kunish Date: Tue, 3 Oct 2023 03:56:44 +0800 Subject: [PATCH] chore(config): do not submit and reset untouched form --- src/components/LogoText.tsx | 2 +- src/pages/ConfigPage.tsx | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/LogoText.tsx b/src/components/LogoText.tsx index 447cff3..754322f 100644 --- a/src/components/LogoText.tsx +++ b/src/components/LogoText.tsx @@ -1,7 +1,7 @@ export const LogoText = () => { return ( { resolver: zodResolver(configFormSchema), defaultValues: configFormDefault }) + const untouched = Object.values(form.formState.dirtyFields).every((dirty) => !dirty) const defaultConfigIdQuery = useGetJSONStorageRequest(['defaultConfigID'] as const) const generalQuery = useGeneralQuery() const configsQuery = useConfigsQuery() @@ -97,6 +98,8 @@ export const ConfigPage = () => { ] }, [generalQuery.data?.general.interfaces, t]) + console.log(form.formState.dirtyFields) + return (

Configs

@@ -187,7 +190,7 @@ export const ConfigPage = () => {
- + {t('primitives.softwareOptions')} @@ -641,11 +644,11 @@ export const ConfigPage = () => {
- -