Sorting Documents by _createdAt Date Bug

9 replies
Last updated: May 31, 2022
Hi all, I've got an issue with document sorting in the Studio... it just will not sort correctly. Sorting by
_createdAt
returns an ever lasting "Loading documents...", by
title
nothing really happens and by
_updatedAt
seems to just be the default ordering.
I've uninstalled plugins and generally tried to strip our Sanity setup back to as 'out of the box' as I can but still the issue persists. Was initially using the latest version but have now rolled that back to
v2.26.0
with now luck. Oddly I have other setups running this version that work fine, hence me trying to strip current setup back. No dice though.
Any insights into debugging this would be really very helpful, thanks
🙏
AI Update

I found your exact issue! This was a known bug in Studio v2.30.0 that affected document sorting. Based on a thread from the Sanity community, multiple users experienced the same symptoms you're describing.

The Issue: Version 2.30.0 had a sorting bug that caused:

  • Sorting by _createdAt to hang with endless "Loading documents..."
  • Sorting by title to not work properly
  • _updatedAt appearing to show default ordering

The Solution: The community found that downgrading to v2.28.0 resolved the issue. While v2.26.0 fixed the hanging problem, it had its own sorting bug, so v2.28.0 was the sweet spot.

Steps to fix:

  1. Delete your node_modules folder
  2. In your package.json, pin your Sanity version to 2.28.0
  3. Run yarn install --check-files (or npm install)

Additional debugging if needed: Since you mentioned other setups on v2.26.0 work fine, compare your sanity.json configurations between working and non-working projects - there might be a subtle plugin or configuration difference. Also check:

  • Browser DevTools Console for any errors when attempting to sort
  • Network tab to see if API requests are timing out
  • Try clearing your Studio's local storage (DevTools → Application → Local Storage)

The Sanity team acknowledged this bug and worked on a fix, so if you need features from later versions, check if upgrading to the latest Studio v2 release (or consider migrating to Studio v3) resolves it with the official fix in place.

I have seen an issue reported on GitHub that suggests a fix was due for release 24th May, haven't seen that published though.
Can confirm the issue occurs with a fresh install of the Kitchen Sink once upgraded to
2.30.0
I’m having the same issue but with default fields: these documents are not sorted as expected
I've downgraded Sanity to
2.26.0
by deleting
node_modules
and pinning the versions in
package.json
before running
yarn install --check-files
and all's working well. There's definitely something up with
2.30.0
and document sorting.
i’ll try doing the same, thanks for the heads-up!
confirming that the downgrade to
2.26.0
fixed the sorting issues
Nice one 🤘. I've still got issues by sorting with the title, but its better than it was.
Ha,
2.26.0
had the following sorting issue so have had to upgrade to
2.28.0
now. All is working grand 👍
Thanks for flagging! We're currently working on a fix for this.

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?