Skip to content

Commit c300a68

Browse files
authored
Fix warning from React about spreading key onto props when editing item in array field (#1389)
1 parent 85c46c7 commit c300a68

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/nine-dolls-appear.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@keystatic/core': patch
3+
---
4+
5+
Fix warning from React about spreading `key` onto props when editing item in
6+
array field

packages/keystatic/src/form/fields/array/ui.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ function ArrayEditItemModalContent(props: {
257257
return { slugs, field: slugField, glob: '*' as const };
258258
}, [props.previewProps, props.modalStateIndex]);
259259

260+
const { key, ...propsWithoutKey } =
261+
props.previewProps.elements[props.modalStateIndex];
262+
260263
return (
261264
<Content>
262265
<VStack
@@ -272,7 +275,7 @@ function ArrayEditItemModalContent(props: {
272275
<FormValueContentFromPreviewProps
273276
slugField={slugInfo}
274277
autoFocus
275-
{...props.previewProps.elements[props.modalStateIndex]}
278+
{...propsWithoutKey}
276279
/>
277280
</VStack>
278281
</Content>

0 commit comments

Comments
 (0)