#optimistic *delete* with infinite query

3 messages · Page 1 of 1 (latest)

pallid quail
#

What should I do if I want to implement optimistic delete? For example:

  • My page size is 10. In getNextPageParam, if the length of lastPage is less than 10, then return undefined to indicate that there's no more data.
  • The first page is loaded
  • I delete one item, setQueryData with 9 remaining items
  • getNextPageParam is called again. Now lastPage only has 9 < 10 items, and it doesn't load anymore.

My hack is to replace the deleted item with null or undefined, and skip them when render.

rustic owl
#

getNextPageParam is called again. Now lastPage only has 9 < 10 items, and it doesn't load anymore.

how is getNextPageParam implemented in your case?

pallid quail