sanity icon indicating copy to clipboard operation
sanity copied to clipboard

Reference fields in arrays can't be sorted in Sanity Studio v3.

Open JonasFolletete opened this issue 1 year ago • 2 comments

Hello,

I found a bug in Sanity Studio v3, references inside of arrays can’t be sorted, the UI is missing and drag isn’t working.

As you can see in the screenshot, this is working for the object field but not for the reference.

To Reproduce

Here is the schema i'm using :

defineField({
      type: 'array',
      group: 'main',
      sortable: true,
      name: 'children',
      title: 'Children',
      of: [
        defineField({
          name: 'collection',
          title: 'Collection',
          type: 'reference',
          to: [{ type: 'collection' }]
        }),
        defineField({
          name: 'link',
          title: 'Link',
          icon: FiLink,
          type: 'object',
          fields: ['...']
       })
    ]
})

Expected behavior

The reference entry should be draggable.

Screenshots

Capture d’écran 2022-08-10 à 12 41 57

Which versions of Sanity are you using?

Run sanity versions in the terminal and copy-paste the result here.

What operating system are you using?

Mac OS 12.2

Which versions of Node.js / npm are you running?

8.1.2 v16.13.2

Thank you very much !

JonasFolletete avatar Aug 10 '22 12:08 JonasFolletete

Thanks for reporting! We're on it :)

rexxars avatar Aug 11 '22 06:08 rexxars

Yep got the same thing over here just as described by @JonasFolletete

nilsborg avatar Sep 20 '22 18:09 nilsborg

I'm also facing this issue. I initially searched for the dialog message that appears when trying to drag and drop a reference to reorder the array: Can't upload any of these files here - now perhaps people facing the same problem will find their way to this issue.

visini avatar Sep 25 '22 07:09 visini

any ideas how to hotfix this for the moment ?

intensr avatar Oct 11 '22 08:10 intensr

We just ran into this issue earlier today, I think this applies for any array of objects within a modal.

shaunchander avatar Nov 18 '22 20:11 shaunchander

This is fixed in the latest RC. Thanks for reporting!

bjoerge avatar Nov 23 '22 16:11 bjoerge