I want to show a list of tasks in a specific order. The problem is that the user should be able to reorder and save it in graphql (the user can also add and remove tasks from lists). Currently, we have implemented the list as a relay connection, and adding / removing / updating is working fine. Here is what we are considering:
- Make graphql a returned ordered list. Then copy this list to the local state in the component and reorder there. Then just notify graphql of the changes.
- Make graphql return a number for all tasks that are sort order.
- Make graphql return the linked list. Therefore, each task has a link to the next in the list.
As I see, there are some problems with each of them. With an ordered list and copying it to a local state, we must somehow handle the add / delete actions and update the local state accordingly.
With the sort order of a number, if we use current numbers, for example. 1..2..3 .., we need to update many numbers when we want to move the number 200 between numbers 1 and 2. It looks like a lot of updates, and I'm not sure how this is handled in relay / graphql.
The linked list also has a lot of accounting related to reordering, and I'm not sure how this is handled in relay mutations. Perhaps returning 3 tasks from the mutation (all tasks that have changed the pointer to the next one in the list) and indicate what is in the "FIELDS_CHANGE" configuration?
relay/graphql/? .