Skip to content

Commit

Permalink
fix: select
Browse files Browse the repository at this point in the history
  • Loading branch information
rharkor committed Feb 20, 2024
1 parent 8cfcf9e commit 41761ff
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
25 changes: 16 additions & 9 deletions packages/app/src/app/[lang]/(protected)/dbackup/add-backup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Modal isOpen={isOpen} onOpenChange={onOpenChange}>
<ModalContent className="scrollbar-thin max-h-[80vh] overflow-auto">
Expand Down Expand Up @@ -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<ReturnType<typeof formSchema>>["pgVersion"])
}
selectedKeys={[pgVersion]}
onChange={(e) => {
form.setValue(
"pgVersion",
e.target.value as z.infer<ReturnType<typeof formSchema>>["pgVersion"]
)
}}
>
{postgresVersion.map((version) => (
<SelectItem
Expand Down Expand Up @@ -255,10 +260,12 @@ export default function AddBackup({
{...field}
isRequired
value={undefined}
onChange={() => {}}
selectedKeys={[form.getValues("pgFormat")]}
onSelectionChange={(value) =>
form.setValue("pgFormat", value as z.infer<ReturnType<typeof formSchema>>["pgFormat"])
selectedKeys={[pgFormat]}
onChange={(e) =>
form.setValue(
"pgFormat",
e.target.value as z.infer<ReturnType<typeof formSchema>>["pgFormat"]
)
}
>
{postgresFormat.map((format) => (
Expand Down
16 changes: 10 additions & 6 deletions packages/app/src/app/[lang]/(protected)/dbackup/update-backup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReturnType<typeof formSchema>>["pgVersion"])
onChange={(e) =>
form.setValue(
"pgVersion",
e.target.value as z.infer<ReturnType<typeof formSchema>>["pgVersion"]
)
}
isDisabled={backup.isLoading}
>
Expand Down Expand Up @@ -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<ReturnType<typeof formSchema>>["pgFormat"])
onChange={(e) =>
form.setValue(
"pgFormat",
e.target.value as z.infer<ReturnType<typeof formSchema>>["pgFormat"]
)
}
isDisabled={backup.isLoading}
>
Expand Down

0 comments on commit 41761ff

Please sign in to comment.