Skip to content

Simplify type for sorting and filtering towards backend #290

Open
@ricardovdheijden

Description

@ricardovdheijden

The graphql endpoint supports filtering and sorting. We always assumed in the frontend that the keys are limited to the keys we see in the response of the endpoint. Therefore we types the fields as "keyof Processes" for example.

However, in the backend itself it is just a string. Since we have this restriction in the frontend we are unable to filter on hidden fields, for example isTask.

Update:
According to a discussion in #384 we might want to keep the types and even add typing tot to the sortBy.

The situation (simplified situation):
Backend returns an object:

{
  id: 'test',
  product: {
    name: 'testName'
  }
}

In the case we want to sort on product.name, the backend expects from us to sorty by productName. Backend does not specifically type this, it is just a string.

Recently a new prop with filterable and sortable fields are returned by backend. We types this as string[]. However we would like to introduce a type for this. Based on this new type we can Pick props for our table types. Introducing this new type will maintain the split between types used for communication with backend and types we use for view-purposes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions