urgent-maroonU
Refine2y ago
26 replies
urgent-maroon

useList CrudSort, wrong naming convention

I am having difficulties using Hasura as my dataProvider, using the graphql-default naming convention, it expects uppercase values for the order_by variable, which useList does not comply with.

My code:
useList<GetFieldsFromList<LatestActivitiesAuditsQuery>>({
    resource: "audits",
    pagination: {
      pageSize: limit,
    },
    sorters: [
      {
        field: "createdAt",
        order: "DESC",
      },
    ],
...

Error in console (attempting query):
Error: expected one of the values ['ASC', 'ASC_NULLS_FIRST', 'ASC_NULLS_LAST', 'DESC', 'DESC_NULLS_FIRST', 'DESC_NULLS_LAST'] for type 'OrderBy', but found 'asc':

Then I get error for ‘order: «DESC»’ in VSCode:
Type '"DESC"' is not assignable to type '"asc" | "desc"'. Did you mean '"desc"'?

CrudSort in refinedev core:
export type CrudSort = {
  field: string;
  order: "asc" | "desc";
};


It seems the query is sent with lowercase.

Is the only solution to edit CrudSort in @refinedev/core/src/contexts/data/types.ts?
Was this page helpful?