Skip to content

Commit 34257a1

Browse files
committed
fix: simplify handleChange function in JsonFormsCollectionDropdownControl and remove unused linkAtom
1 parent b4f83c6 commit 34257a1

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

apps/studio/src/features/editing-experience/components/form-builder/renderers/controls/JsonFormsCollectionDropdownControl.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ import { and, rankWith, schemaMatches } from "@jsonforms/core"
44
import { withJsonFormsControlProps } from "@jsonforms/react"
55
import { FormLabel, SingleSelect } from "@opengovsg/design-system-react"
66
import { COLLECTION_DROPDOWN_FORMAT } from "@opengovsg/isomer-components"
7-
import { useSetAtom } from "jotai"
87

98
import Suspense from "~/components/Suspense"
109
import { JSON_FORMS_RANKING } from "~/constants/formBuilder"
11-
import { linkAtom } from "~/features/editing-experience/atoms"
1210
import { siteSchema } from "~/features/editing-experience/schema"
1311
import { useQueryParse } from "~/hooks/useQueryParse"
1412
import { trpc } from "~/utils/trpc"
@@ -45,9 +43,7 @@ function SuspendableJsonFormsCollectionDropdownControl({
4543
}
4644
})}
4745
isClearable={false}
48-
onChange={(value) => {
49-
handleChange(path, value)
50-
}}
46+
onChange={(value) => handleChange(path, value)}
5147
/>
5248
)
5349
}
@@ -58,21 +54,13 @@ export function JsonFormsCollectionDropdownControl({
5854
label,
5955
...props
6056
}: ControlProps) {
61-
const setLink = useSetAtom(linkAtom)
62-
63-
const handleChange: ControlProps["handleChange"] = (path, value: string) => {
64-
props.handleChange(path, value)
65-
setLink((prev) => ({ ...prev, category: value }))
66-
}
67-
6857
return (
6958
<FormControl isRequired={required} gap="0.5rem">
7059
<FormLabel description={description}>{label}</FormLabel>
7160
<Suspense fallback={<Skeleton />}>
7261
<SuspendableJsonFormsCollectionDropdownControl
7362
{...props}
7463
label={label}
75-
handleChange={handleChange}
7664
/>
7765
</Suspense>
7866
</FormControl>

0 commit comments

Comments
 (0)