Oliver seeks help with fetching query content in descending order from release number in Sanity.
17 replies
Last updated: Aug 5, 2022
O
So I am still pretty new to sanity and I was trying to fetch query content from the release number descending, when I fetch it in the vision section it seems to do it fine but when I try fetch it in js it doesnt seem to show up like that on the site?
Aug 5, 2022, 8:27 PM
K
Hey Oliver. Could you please group all your messages so we use a single thread?
Aug 5, 2022, 8:34 PM
user S
please group your question in a single thread so that we can keep track of all relevant information. It makes it easier to help you!Aug 5, 2022, 8:34 PM
K
user M
💚Aug 5, 2022, 8:34 PM
O
oh yeah sure sorry
Aug 5, 2022, 8:39 PM
O
this is vue also
would rly appreciate the help doing this for a record label and want it to work perfectly :)
[9:30 PM] its fetching perfectly in vision though
basically I want it to show up on the site in descending order from release num, so DY-002, DY-001 etc
would rly appreciate the help doing this for a record label and want it to work perfectly :)
[9:30 PM] its fetching perfectly in vision though
basically I want it to show up on the site in descending order from release num, so DY-002, DY-001 etc
Aug 5, 2022, 8:39 PM
Can you share the link to the Vision query that's working properly? It should be right above your results pane in the plugin.
Aug 5, 2022, 8:49 PM
O
O
so it orders it properly by order(releaseNum desc)
Aug 5, 2022, 8:54 PM
O
what do you mean sorry? i set this as the query *[_type == "post"] | order(releaseNum desc)
Aug 5, 2022, 9:05 PM
What I meant was that if the screenshot is from your production website (which the list order does appear to match), then your query is this: . You can open the Network tab in your dev tools and filter by
*[_type == "post"]{ _id, releaseNum, artistName, releaseName, slug, releaseDate, releaseType, anr, }[0...50]
production, and that’s the GET request.
Aug 5, 2022, 9:09 PM
If you’re also seeing that same order in your local or staging environment, where
order()is implemented in the query, then maybe some screenshots of that would help.
Aug 5, 2022, 9:10 PM
O
oh im so stupid ahaha. So do I have to order it in the post.js in schemas and then pass it through to the vue file some how?
Aug 5, 2022, 9:26 PM
Not to worry!
No, you don’t need to worry about it in your schema. You’ll want to add
No, you don’t need to worry about it in your schema. You’ll want to add
| order(releaseNum desc)to your query that you’re doing in Vue using the Sanity Client.
Aug 5, 2022, 9:28 PM
O
thank you! that worked perfectly :D
Aug 5, 2022, 9:54 PM
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.