TanStackT
TanStack2y ago
16 replies
popular-magenta

optimistic update with pagination

In my task management app, I have tables for different task statuses (with sorting and filtering). Each table also has pagination (max of 50 tasks per page). Now, when I change the status of a task, I want it to update optimistically. This requires -

1. removing the task from the page where it initially was and also adding one task from the next page (if there is one) to maintain the 50 tasks in one page. Then a refetch for this page.
2. checking the currently visible page of the new status and adding the task to the page if it is meant to be on that page (based on the sort order). If it is, then I need to delete one task from that page to maintain 50 tasks in one page.

This seems pretty complex. Am I overcomplicating things in some way or this makes sense?
Was this page helpful?