#How to revalidate a paginated table on page change while keeping summary section static in Remix?

1 messages · Page 1 of 1 (latest)

raw finch
#

I'm working on a page in Remix that has two sections. One is a summary section showing overall stats (this should be static and never change), and the other is a paginated table that displays data. I want the paginated table to be revalidated (i.e., refetched or refreshed) whenever the page changes, but I don't want the summary section to be affected by these changes.

What’s the best way to achieve this behavior in Remix? Should I use useLoaderData in a specific way or is there another pattern I should consider? Any advice or examples would be greatly appreciated!

shadow flame
#

There are a few approaches I know.. Each one has its own trade offs..

  1. Using a server side cache (In general easier, but in some cases you may worry about server memory or infrastructure)
  2. Create a layout route which loader only returns the static data then use shouldRevalidate false (may make sense in some cases, I personally dont like creating extra routes only to fit data requirements though)
  3. Not use loader data and rely on a client side cache instead (provides more control but may require adittional lib)