Sanity: Missing documents on custom datetime sort order if you have many elements

Created on 4 Apr 2020  路  3Comments  路  Source: sanity-io/sanity

I'm not getting the expected result out of a custom datetime sort order in the studio if I have so many documents that sanity will need to fetch more on scroll.

I have a schema with the following field:

    {
      title: 'Stream date',
      name: 'streamDate',
      type: 'datetime',
      options: {
        timeStep: 60,
      },
      validation: Rule => Rule.required(),
    },

and custom sort order according to https://www.sanity.io/docs/sort-orders:

  preview: {
    select: {
      title: 'title',
      subtitle: 'streamDate',
      media: 'poster',
    },
  },
  orderings: [
    {
      title: 'Stream date',
      name: 'streamDateDesc',
      by: [
        {field: 'streamDate', direction: 'desc'}
      ]
    },
  ],

Here are the first documents from the studio before scrolling:
image

After scrolling to the bottom of the list (no more documents to show) the first documents looks like this:
image

As you can see, after scrolling to the end of the list and up again the list have been populated with more documents (e.g. Jakobstr酶m x Brakkesyke: 膾).
The second screenshot is the correct ordering and what I would expect to also get without scrolling.

To Reproduce

Steps to reproduce the behavior:

  1. Create a document with a datetime field and make a sort order on it
  2. Add as many elements needed to trigger scroll on a document list in sanity
  3. Use custom sort order.
  4. See what documents are at the top
  5. Scroll to to bottom of the list then up again and see if the list looks the same

Expected behavior

The list should always look the same when using the same order.

Which versions of Sanity are you using?

@sanity/cli             1.149.6 (latest: 1.149.9)
@sanity/base            1.149.8 (up to date)
@sanity/components      1.149.8 (up to date)
@sanity/core            1.149.9 (up to date)
@sanity/default-layout  1.149.8 (up to date)
@sanity/default-login   1.149.7 (up to date)
@sanity/desk-tool       1.149.8 (up to date)
@sanity/vision          1.149.0 (up to date)

What operating system are you using?

Description:    Ubuntu 18.04.4 LTS
Release:    18.04
Codename:   bionic

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

6.13.4
v12.16.1
Bug Studio

Most helpful comment

Hi and thank you for reporting! This is a known issue and we are looking into a fix 馃憤

All 3 comments

Hi and thank you for reporting! This is a known issue and we are looking into a fix 馃憤

I'm seeing the same issue. Weirdly, it only seems to happen in the dev server: my deployed version of Sanity Studio doesn't have this problem.

I'm also seeing this issue (but on dev and prod), not just on sorts of datetime fields but also string fields (which we use a lot to sort by name or title). This is very confusing for editors since it seems like some documents are missing. It also makes for a bad experience when you are scrolling through the list, since halfway through (e.g. when you are already on the letter M) the list reorders and you jump to a different letter (e.g. letter C).

This issue pretty much makes custom orderings unusable for document lists with more than a few dozen documents. Here's hoping a fix for this problem is found soon. :crossed_fingers:

Was this page helpful?
0 / 5 - 0 ratings