From 41761ff713d9dcf5984ae6503b2f80f41b10490a Mon Sep 17 00:00:00 2001 From: rharkor Date: Tue, 20 Feb 2024 19:30:37 +0100 Subject: [PATCH] fix: select --- .../[lang]/(protected)/dbackup/add-backup.tsx | 25 ++++++++++++------- .../(protected)/dbackup/update-backup.tsx | 16 +++++++----- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/packages/app/src/app/[lang]/(protected)/dbackup/add-backup.tsx b/packages/app/src/app/[lang]/(protected)/dbackup/add-backup.tsx index f13aa507..0afe1e39 100644 --- a/packages/app/src/app/[lang]/(protected)/dbackup/add-backup.tsx +++ b/packages/app/src/app/[lang]/(protected)/dbackup/add-backup.tsx @@ -80,6 +80,9 @@ export default function AddBackup({ if (!isOpen) form.reset() }, [isOpen, form]) + const pgVersion = form.watch("pgVersion") + const pgFormat = form.watch("pgFormat") + return ( @@ -218,11 +221,13 @@ export default function AddBackup({ {...field} isRequired value={undefined} - onChange={() => {}} - selectedKeys={[form.getValues("pgVersion")]} - onSelectionChange={(value) => - form.setValue("pgVersion", value as z.infer>["pgVersion"]) - } + selectedKeys={[pgVersion]} + onChange={(e) => { + form.setValue( + "pgVersion", + e.target.value as z.infer>["pgVersion"] + ) + }} > {postgresVersion.map((version) => ( {}} - selectedKeys={[form.getValues("pgFormat")]} - onSelectionChange={(value) => - form.setValue("pgFormat", value as z.infer>["pgFormat"]) + selectedKeys={[pgFormat]} + onChange={(e) => + form.setValue( + "pgFormat", + e.target.value as z.infer>["pgFormat"] + ) } > {postgresFormat.map((format) => ( diff --git a/packages/app/src/app/[lang]/(protected)/dbackup/update-backup.tsx b/packages/app/src/app/[lang]/(protected)/dbackup/update-backup.tsx index 56784bd4..6a2aae98 100644 --- a/packages/app/src/app/[lang]/(protected)/dbackup/update-backup.tsx +++ b/packages/app/src/app/[lang]/(protected)/dbackup/update-backup.tsx @@ -247,10 +247,12 @@ export default function UpdateBackup({ {...field} isRequired value={undefined} - onChange={() => {}} selectedKeys={pgVersion ? [pgVersion] : undefined} - onSelectionChange={(value) => - form.setValue("pgVersion", value as z.infer>["pgVersion"]) + onChange={(e) => + form.setValue( + "pgVersion", + e.target.value as z.infer>["pgVersion"] + ) } isDisabled={backup.isLoading} > @@ -286,10 +288,12 @@ export default function UpdateBackup({ {...field} isRequired value={undefined} - onChange={() => {}} selectedKeys={pgFormat ? [pgFormat] : undefined} - onSelectionChange={(value) => - form.setValue("pgFormat", value as z.infer>["pgFormat"]) + onChange={(e) => + form.setValue( + "pgFormat", + e.target.value as z.infer>["pgFormat"] + ) } isDisabled={backup.isLoading} >