I'm currently building my first JAM stack app using Nuxt as my front-end framework and Craft as my headless CMS. I'm leveraging Apollo as my GraphQL interface client. I have it pulling data back just fine, but I want to shuffle the output to always be random. I know I could do this in a typical twig query with .orderBy('RAND()')
but I need a way to shuffle that with my GraphQL endpoint.
I know I can do this on the frontend by shuffling my <li>
s or something, but would love for this to be more performant if I can help it.
I've tried a few variations of the below but can't seem to get it to work. Is this possible?
apollo: {
entries: {
query: stories,
prefetch: true,
variables: {
"section": ["stories"],
"orderBy": "RAND()"
}
}
},