👋 Next.js Conf 2024: Come build, party, run, and connect with us! See all events

Discussion about issues with the Orderable Document List plugin and querying in Sanity Studio

12 replies
Last updated: Jan 11, 2022
This is an open question since it's Official plugin but, as a plugin, maybe not considered for Support ( I am still on a free plan as well )
I worked up the Orderable Document List and it works amazingly well, truly, in the Studio itself, and even in queries -- but when my documents change order, that change isn't reflected in front page code. At first I thought, maybe caching? But

• the array inside the document (reordering lists of references) updates instantly, and
• I can confirm no caching is set in my Client or the hosting service for the front end.
I am wondering what I should be looking for where even GROQ thinks it's fine but the returned query results aren't. The array comes to me not reflecting the change, and since it's a unique order of their choosing I can't correct for it once received.


EDIT: Thanks to Geoff I learned that I needed to include the ordering field from the schema in the list of returned projections, instead of just calling for it in the order() function. Thought I'd post an update for anyone else learning.
Jan 11, 2022, 12:15 AM
Hi Vincent. The order of documents in your studio won’t be related to how they render on the front end. You can specify an order in your GROQ query using order() .
Jan 11, 2022, 12:18 AM
In fact, I believe that plugin adds a field to your documents. If you order by that field in ascending order, you should get the same order.
Jan 11, 2022, 12:21 AM
In fact, I believe that plugin adds a field to your documents. If you order by that field in ascending order, you should get the same order.
Jan 11, 2022, 12:21 AM
My query has the same
| order(orderRank)
as the documentation, and adding and removing it changes the results in GROQ like I'd expect. The only place it's different is the response as received on the webpage.
Jan 11, 2022, 12:24 AM
What does your web page’s query look like?
Jan 11, 2022, 12:26 AM
Thanks for the quick response! 😃 I was just about to show you in case my other choices are borking it.
Jan 11, 2022, 12:26 AM
(side note that getting to declare my own keys and feeding them results is aaamaaazingly nice)
Jan 11, 2022, 12:27 AM
With that query, if I re-order the documents, Vision will say that it sees the change. But visiting the live webpage that seems to understand and reflect every other change, misses that one ( I thought it was my looping code but the raw array is like that too)
Jan 11, 2022, 12:28 AM
I just found the Github for the plugin and it seems similar -- as of November not yet closed off https://github.com/sanity-io/orderable-document-list/issues/4 ( I am on 2.23.2 it seems, so ahead of them)
Jan 11, 2022, 12:31 AM
I don’t have this plugin installed but can try after dinner, or if you want you can DM your project ID or the query URL near the top in Vision (if the dataset is public).
Jan 11, 2022, 12:34 AM
I have a colleague evaluating the back end soon and I can't get in touch with him at the moment to let him know someone would be coming and I don't wanna spook him but otherwise I would. It's public. If you'd be so kind to check in after dinner I'd be genuinely grateful.
I know you guys probably don't accept tips or donations here but I should probably start pay as you go even though I don't need overages yet just so I'm contributing something :)
Jan 11, 2022, 12:42 AM
Oh I'm dumb you mean for query building not for going in the back end. Yes I'll grab that once I get home in about fifteen minutes
Jan 11, 2022, 12:55 AM

Sanity– build remarkable experiences at scale

Sanity is a modern 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?