From c300a68253a3ea95662aae19fdae880727da899a Mon Sep 17 00:00:00 2001 From: Emma Hamilton Date: Fri, 10 Jan 2025 14:08:05 +1000 Subject: [PATCH] Fix warning from React about spreading `key` onto props when editing item in array field (#1389) --- .changeset/nine-dolls-appear.md | 6 ++++++ packages/keystatic/src/form/fields/array/ui.tsx | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/nine-dolls-appear.md diff --git a/.changeset/nine-dolls-appear.md b/.changeset/nine-dolls-appear.md new file mode 100644 index 000000000..1b424c837 --- /dev/null +++ b/.changeset/nine-dolls-appear.md @@ -0,0 +1,6 @@ +--- +'@keystatic/core': patch +--- + +Fix warning from React about spreading `key` onto props when editing item in +array field diff --git a/packages/keystatic/src/form/fields/array/ui.tsx b/packages/keystatic/src/form/fields/array/ui.tsx index da84f9220..866f7f2af 100644 --- a/packages/keystatic/src/form/fields/array/ui.tsx +++ b/packages/keystatic/src/form/fields/array/ui.tsx @@ -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 (