Skip to content

Commit

Permalink
fix(form): avoid spreading key prop (#6776)
Browse files Browse the repository at this point in the history
Before this change, React would throw a runtime error stating that `A props
object containing a "key" prop is being spread into JSX`. Now, the `key` is
passed to the JSX without using spread.
  • Loading branch information
christianhg committed May 29, 2024
1 parent 9d7c67d commit eeba7f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/sanity/src/core/form/studio/FormBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export function FormBuilder(props: FormBuilderProps) {
[Field],
)
const renderItem = useCallback(
(itemProps: Omit<ItemProps, 'renderDefault'>) => <Item {...itemProps} />,
({key, ...itemProps}: Omit<ItemProps, 'renderDefault'>) => <Item key={key} {...itemProps} />,
[Item],
)
const renderPreview = useCallback(
Expand Down

0 comments on commit eeba7f2

Please sign in to comment.