Error when using orderable document list plugin in pressroom implementation

12 replies
Last updated: Mar 8, 2023
Hi! I made a pressroom for my client as an orderable document list, but after some sorting / recreating of the attached files the document crashes with this error. does anybody know sth?
Mar 7, 2023, 3:08 PM
How have you configured the plugin?
Mar 7, 2023, 5:33 PM
I didnt do any further configuration, just imported
import {orderableDocumentListDeskItem} from '@sanity/orderable-document-list'
and defined an item in my desk structure as an
orderableDocumentListDeskItem
Mar 8, 2023, 5:31 PM
...

S.listItem()

.title('Pressroom')

.icon(DocumentsIcon)

.child(

S.list()

.title('Pressroom')

.items([

S.listItem()

.title('Behind The Studio')

.schemaType('pressroom-bio')

.icon(InfoOutlineIcon)

.child(S.document().schemaType('pressroom-bio').documentId('pressroom-bio')),

orderableDocumentListDeskItem(

{type: 'pressroom',

title: 'Pressroom',

S,

context}),

])

),

...
Mar 8, 2023, 5:34 PM
this is my snippet
Mar 8, 2023, 5:34 PM
Did you set up order rank fields on your documents?
Mar 8, 2023, 5:36 PM
Yes
Mar 8, 2023, 5:41 PM
export default {
  name: 'pressroom',
  title: 'Pressroom',
  type: 'document',
  fields: [
    {
      title: 'Media',
      name: 'article',
      type: 'file',
      fields: [
        {
          title: 'Preview Image',
          name: 'preview',
          type: 'image',
          options: {
            hotspot: true, // <-- Defaults to false
            metadata: [
              'blurhash', // Default: included
              'lqip', // Default: included
              'palette', // Default: included
              'exif', // Default: not included
              'location', // Default: not included
            ],
          },
        },
        {
          name: 'name',
          type: 'string',
          title: 'Title',
        },
      ],
    },
    {
      title: 'Order Rank',
      name: 'orderRank',
      type: 'string',
    },
  ],
  preview: {
    select: {
      title: 'article.name',
      image: 'article.image',
    },
    prepare(selection) {
      const {title, image} = selection
      return {
        title: title,
        image: image,
      }
    },
  },
}
Mar 8, 2023, 5:43 PM
I worst-practiced the title field and named it “name”, but when i change it the error still occurs
Mar 8, 2023, 5:43 PM
weirdly on some uploaded documents it works fine
Mar 8, 2023, 5:44 PM
Looks like that’s not the correct way to set up an order rank field.
Mar 8, 2023, 6:10 PM
thank you! i will redo the implementation
Mar 8, 2023, 6:25 PM
Let us know if that fixes it!
Mar 8, 2023, 6:27 PM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?