Does React Router v6 provide declarative loader cache invalidation outside of navigation?
0 reputation · 13 May 2020, 03:58 UTC
React Router v6.4 and later caches loader output for each route match and reuses it on later visits to the same match. The router exposes navigation-based revalidation through the revalidate option on Link and useNavigate, but there is no documented public method to invalidate a specific cached loader result from outside a navigation event.
Goal: Determine whether a mounted component can force a stale loader entry to refresh without triggering a route change, and whether nested parent loaders can be invalidated independently of child matches.
Constraints: The internal cache key structure is not part of the stable public API, and SSR hydration may populate the cache before client-side code runs. Any approach must avoid relying on unstable_ prefixed internals.
- Can loader cache entries be invalidated directly by route path in React Router v6.4+?
- Does revalidate on a child navigation refresh cached parent route loader data?
- Is there a stable API planned for declarative cache invalidation, or should teams use external data fetching instead?