clear-react-router 2.6.3 → 2.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +6 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -129,6 +129,7 @@ Normalizes route configuration. Extracts dynamic params, builds nested paths.
129
129
  | `loaderFallback` | `ReactElement \| () => ReactElement` | Loading fallback for the route's `loader`. Overrides the global `Router.defaultLoaderFallback` |
130
130
  | `retry` | `number \| { count: number; delay: number }` | Overrides the global cache revalidation retry policy for this route |
131
131
  | `optimistic` | `boolean \| undefined` | Instant navigation using stale data while fresh data is loaded in the background |
132
+ | `keepPreviousData` | `boolean \| undefined` | During `pending`, keep the previous loader data on screen instead of showing `loaderFallback` — for same-element navigations (e.g. table filters/sort/pagination). Replaces the previous data with `errorElement` if the new load fails; `optimistic` takes precedence when both are set |
132
133
  | `errorElement` | `ReactElement \| () => ReactElement \| LazyComponent` | Error fallback for the route. Overrides the global `Router.defaultErrorElement` |
133
134
  | `staleTime` | `number \| undefined` | Time in milliseconds before cached loader data is considered stale. Overrides Router.defaultStaleTime. If neither value is provided, data is stale immediately and navigation revalidates it. Use `Infinity` to never consider it stale |
134
135
  | `externalCache` | `boolean \| undefined` | The route's data freshness is owned by the loader's source (e.g. an external cache like TanStack Query): the router cache stores values but never claims freshness, so every navigation re-runs the loader. Inherited by children; a child can opt out with `false` |
@@ -138,6 +139,11 @@ Normalizes route configuration. Extracts dynamic params, builds nested paths.
138
139
  | `scrollRestoration` | `boolean \| string[] \| undefined` | Restore scroll position when navigating back to this route. `true` restores the window scroll; a string array restores scroll inside specific scrollable elements, matched by their `id` |
139
140
  | `scrollRestorationBehavior` | `'auto' \| 'smooth' \| 'instant'` | Scroll restoration behavior |
140
141
 
142
+ > **Render during loading:** while a route is `pending`, the router shows, in order of precedence:
143
+ > `optimistic` (cached snapshot for revisited keys) → `keepPreviousData` (previous data of the same
144
+ > element — table filters, sort and pagination) → `loaderFallback`. An error always replaces the
145
+ > content with `errorElement`.
146
+
141
147
  `beforeLoad`, `loader` and `actions` receive:
142
148
 
143
149
  ```ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clear-react-router",
3
- "version": "2.6.3",
3
+ "version": "2.6.4",
4
4
  "description": "A lightweight routing library for React applications",
5
5
  "author": "Andrew Bubnov",
6
6
  "scripts": {