sanity: Cannot reorder items in array after publish
Items in array are not draggable after either restoring to an older version or sometimes after publish
To Reproduce
Steps to reproduce the behavior:
- Create a fresh project using
npm create sanity@latest -- --template clean --create-project "Sanity Project" --dataset production
- Add this simple schema
import { defineField, defineType, defineArrayMember } from 'sanity'
export default defineType({
name: 'post',
title: 'Post',
type: 'document',
fields: [
defineField({
name: 'title',
title: 'Title',
type: 'string',
}),
{
name: "tags",
type: "array",
title: "Tags for item",
of: [{
type: 'item',
name: 'tag',
}]
},
],
preview: {
select: {
title: 'title',
},
},
})
- Edit things and refresh, sometimes the array sorting just stops working.
- Seems like the app is re-rendering and I get this error:
ArrayOfObjectsField.tsx:248 Neither the item you are moving nor the item you are moving to have a key. Cannot continue.
Expected behavior
Sorting should be possible
Screenshots Here is a video:
https://github.com/sanity-io/sanity/assets/296355/18d5ea62-6d3c-4c56-9d6c-ff97ae0a938c
Which versions of Sanity are you using?
@sanity/cli (global) 3.15.1 (latest: 3.20.0) @sanity/eslint-config-studio 3.0.1 (up to date) @sanity/vision 3.20.0 (up to date) sanity 3.20.0 (up to date)
What operating system are you using?
MacOS Sonoma, Macbook pro M1
Which versions of Node.js / npm are you running?
Run npm -v && node -v
in the terminal and copy-paste the result here.
8.15.0 v16.17.0
I have also created this https://codesandbox.io/p/sandbox/clever-einstein-r696v9, but cannot reproduce the issue there. But happens consistently on my local machine, I’m going crazy!!
Sometimes I get this error before this happens:
react-dom.development.js:86 Warning: React does not recognize the
withTooltipprop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase
withtooltip instead. If you accidentally passed it from a parent component, remove it from the DOM element....
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Comments: 18 (2 by maintainers)
Also adding that i have tried this exact setup in a Chrome Incognito window, so without any extensions activated and a clean cache. Same bug…