Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing documents on custom datetime sort order if you have many elements #1825

Closed
nettum opened this issue Apr 4, 2020 · 13 comments
Closed
Labels

Comments

@nettum
Copy link

nettum commented Apr 4, 2020

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
@vicmeow vicmeow added the bug label Apr 4, 2020
@vicmeow
Copy link
Contributor

vicmeow commented Apr 4, 2020

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

@vicmeow vicmeow added the Studio label Apr 4, 2020
@mjm
Copy link

mjm commented Apr 6, 2020

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.

@fvieira
Copy link

fvieira commented May 23, 2020

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. 🤞

@Slooowpoke
Copy link

Was there any update on this? (or any pointers for where I might be able to start and try my hand at a fix)?

@d3vhound
Copy link

Just encountered the same issue with ~150 records. Scrolling down then back up loads 10 missing posts at the top. Hoping this gets more traction.

@cbovis
Copy link

cbovis commented Aug 18, 2021

Any update on this one @vicbergquist? As noted in others comments this is quite a severe bug so it's quite concerning that the team hasn't been able to fix this in four months.

@vicmeow
Copy link
Contributor

vicmeow commented Aug 18, 2021

@cbovis thanks for checking in on this, will look into it 😊

@cbovis
Copy link

cbovis commented Oct 4, 2021

Any update on this one @vicbergquist ?

@jackdewhurst
Copy link

Same issue with ~400 records. Any update?

@calvary-tucson
Copy link

Same issue with ~2000 records. Any update?

@RaphaelPI
Copy link

Hello here :)

Any updates on this one ?

@nettum
Copy link
Author

nettum commented Mar 10, 2022

I just upgraded to v2.28.0 and this seems to be fixed 🎉

@nettum
Copy link
Author

nettum commented Jun 1, 2022

Closing issue as this is fixed (again) on v2.30.1.

@nettum nettum closed this as completed Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants