react sync local state list reorder with backend

Viewed 204

I am using a Graphql API endpoint for data fetching and mutation and apollo client for state management. I am using react-beautiful-dnd to drag components across columns. On updating the index and columnid of a draggable component how do I handle syncing this reordering of the list with my Postgres backend?

Should I create a duplicate table for each column which will delete all of its data and update its rows with new reordered data each time a reorder takes place? This will keep the original order of the list separated in a main table. But this feels hacky and I guess would not be very performant.

What will be the correct approach to handle this? Trello and many other kanban boards like apps support this.

0 Answers
Related