State While Revalidate

State While Revalidate is an HTTP cache invalidation strategy popularized by HTTP RFC 5861.

  1. display the data from cache if available (stale),
  2. send a request for new data (revalidate)
  3. display the up-to-date data

This kind of model works with simple HTTP queries and does not need advanced tooling such as the one from Firebase to keep data up date.

For example SWR library from Next.JS uses events such as change of tab, network reconnection, out of sleep and timers to fetch data from time to time and keep the display fresh.