clear-react-router 1.3.7 → 1.3.8

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/dist/index.js +9 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -195,6 +195,7 @@ var useHandleNavigation = ({ setLocation, routeList, context, revalidateCache, i
195
195
  });
196
196
  return;
197
197
  }
198
+ else setBeforeLoadError(false);
198
199
  if (seq !== navigationSeq.current) return;
199
200
  await revalidateCache({
200
201
  routeItem: nextItem,
@@ -293,11 +294,17 @@ var useLoader = ({ routeList, context, setContext }) => {
293
294
  return Date.now() - currentCacheTimestamp < routeItem.staleTime;
294
295
  }, []);
295
296
  const revalidateCache = useCallback(async ({ routeItem, isCurrentRoute, pathname }) => {
296
- if (!routeItem?.loader) return;
297
+ if (!routeItem?.loader) {
298
+ setLoaderError(false);
299
+ return;
300
+ }
297
301
  if (isCacheItemFresh({
298
302
  routeItem,
299
303
  pathname
300
- }) && isCurrentRoute) setLoaderCache(loaderCacheRef.current[pathname]);
304
+ }) && isCurrentRoute) {
305
+ setLoaderCache(loaderCacheRef.current[pathname]);
306
+ setLoaderError(false);
307
+ }
301
308
  if (isCacheItemFresh({
302
309
  routeItem,
303
310
  pathname
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clear-react-router",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "description": "A lightweight, type-safe routing library for React applications",
5
5
  "author": "Andrew Bubnov",
6
6
  "scripts": {