Skip to content

Commit

Permalink
Fix warning from React about spreading key onto props when editing …
Browse files Browse the repository at this point in the history
…item in array field (#1389)
  • Loading branch information
emmatown authored Jan 10, 2025
1 parent 85c46c7 commit c300a68
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/nine-dolls-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@keystatic/core': patch
---

Fix warning from React about spreading `key` onto props when editing item in
array field
5 changes: 4 additions & 1 deletion packages/keystatic/src/form/fields/array/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ function ArrayEditItemModalContent(props: {
return { slugs, field: slugField, glob: '*' as const };
}, [props.previewProps, props.modalStateIndex]);

const { key, ...propsWithoutKey } =
props.previewProps.elements[props.modalStateIndex];

return (
<Content>
<VStack
Expand All @@ -272,7 +275,7 @@ function ArrayEditItemModalContent(props: {
<FormValueContentFromPreviewProps
slugField={slugInfo}
autoFocus
{...props.previewProps.elements[props.modalStateIndex]}
{...propsWithoutKey}
/>
</VStack>
</Content>
Expand Down

0 comments on commit c300a68

Please sign in to comment.