riverqueue / riverui

A web interface for River, fast and reliable background jobs in Go.
https://ui.riverqueue.com/
Mozilla Public License 2.0
43 stars 3 forks source link

fix job list pagination flashing w/ placeholderData #56

Closed bgentry closed 1 week ago

bgentry commented 1 week ago

Use the approaches outlined on the paginated queries and placeholder data docs for Tanstack Query to ensure that the page doesn't flash disruptively when changing the pagination count, so long as the rest of the params are still unchanged (state).

https://tanstack.com/query/latest/docs/framework/react/guides/paginated-queries#better-paginated-queries-with-placeholderdata https://tanstack.com/query/latest/docs/framework/react/guides/placeholder-query-data

Fixes #55.

bgentry commented 1 week ago

@brandur this may not be stuff you're very familiar with but it's probably worth at least starting to get more in touch with the UI code here. TanStack Query is pretty great!

I don't expect we'll need to do this on a lot of pages and the approach will evolve some as we add additional filtering options on this page. For now this should suffice.

brandur commented 1 week ago

K thanks. Yep definitely good to look at since to me, "TanStack Query" sounds like a character out of the Star Wars cantina. Just read the docs though, and interesting.