-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
I have been looking for a solution for this but it is apparently impossible (or at least very impractical; see below).
For example:
*[] | order($orderBy)
With params
{ "orderBy": "createdAt"}
The only "not-really-a-solution" I found is this:
*[] | order(select(
$orderBy == "_createdAt" => _createdAt,
_id
))
(context: I am using the plugin sanity-plugin-documents-pane and the Sanity studio crashed when trying to do the same for asc)
This is deeply impractical.
Improvements I can come up with:
- A function or specific syntax to unquote strings. E.g.
*[] | order(unquote($orderBy)) - Being able to lookup a scope for a dot-notation path.
*[] | order(@[$orderBy])
Or
*[]
{
...@,
"temp": @[$orderBy],
}
| order(temp)
alejandrovrojas, conordavidson, lucaswalter, Cooksauce, matzexcom and 4 more
Metadata
Metadata
Assignees
Labels
No labels