GraphQL order_by precedence
I need to be able to specify the order of my
order_by
fields sent via the GraphQL client to Hasura. Currently, when I send two fields, the order is ignored. I reached out to Hasura and they say the query needs to be modified. I am sending:
which results in the query:
but what I need to send is:
how can I send this via the standard hooks?4 Replies
Hi @geoffatsource. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the information provided in the extracts, the
sorters
prop in refine's hooks like useTable
, useSelect
, and useCustom
allows you to specify the order of fields. However, the format used is an array of objects, each containing a field
and order
property, like so:
This is then passed to the dataProvider
method and used to send sort query parameters to the API. However, the extracts do not provide information on how to modify this format to match the specific format you need for Hasura:
It seems that you might need to customize the dataProvider
to transform the sorters
array into the format required by Hasura. Unfortunately, the provided extracts do not contain specific information on how to achieve this.
For more detailed guidance, you might want to refer to the refine documentation (https://refine.dev/docs) or seek advice from the refine community.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1014305963219615754> kapa.ai is still learning and improving, please let us know how it did by reacting below
deep-jade•10mo ago
Hello @geoffatsource it seems we have an issue on mapping filter parameters to hasura queries correctly, quick solution would be to swizzle the hasura data provider, and modify it: https://refine.dev/docs/tutorial/understanding-dataprovider/swizzle/
You can also create an issue on GitHub
2. Create a data provider with swizzle | refine
What is swizzle?
graceful-blue•10mo ago
Thanks! Yes, we've already swizzled so we'll make the changes locally.