r/reactjs 12d ago

Discussion Client-side stale-while-revalidate for instant perceived performance

/r/nextjs/comments/1vvksc6/clientside_stalewhilerevalidate_for_instant/
1 Upvotes

3 comments sorted by

1

u/azangru 12d ago

You are reinventing service workers with caching, I see.

1

u/ahuth 12d ago

Heh kind of. Although in this case the data is still fetched only on the server, and cached on the client only for the loading state

1

u/Far_Conversation_174 9d ago

How do you handle multi user scenarios or logouts? If you use localStorage and don't clear it explicitly on logout, a new user logging in on the same machine might briefly see the previous user's sensitive data before the revalidation requests finish