clear-react-router 1.5.6 → 1.5.7

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 +8 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -229,14 +229,6 @@ var useHandleNavigation = ({ routeList, context, revalidateCache, setContext, is
229
229
  history.pushState(null, "", fullPath);
230
230
  }, []);
231
231
  const transitionedNavigation = useCallback((nextLocation, routeItem) => {
232
- setScrollMap((prevState) => {
233
- const scrollPosition = document.scrollingElement?.scrollTop ?? 0;
234
- if (!scrollPosition || prevState[prevPathname.current] === scrollPosition) return prevState;
235
- return {
236
- ...prevState,
237
- [prevPathname.current]: scrollPosition
238
- };
239
- });
240
232
  if (!isAnimated) {
241
233
  navigation(nextLocation, routeItem);
242
234
  return;
@@ -276,6 +268,14 @@ var useHandleNavigation = ({ routeList, context, revalidateCache, setContext, is
276
268
  return transitionedNavigation(nextLocation, nextItem);
277
269
  }
278
270
  if (seq !== navigationSeq.current) return;
271
+ setScrollMap((prevState) => {
272
+ const scrollPosition = document.scrollingElement?.scrollTop ?? 0;
273
+ if (!scrollPosition || prevState[prevPathname.current] === scrollPosition) return prevState;
274
+ return {
275
+ ...prevState,
276
+ [prevPathname.current]: scrollPosition
277
+ };
278
+ });
279
279
  setCurrentLoaderFallback(isCacheItemFresh({
280
280
  routeItem: nextItem,
281
281
  pathname: nextLocation.pathname
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clear-react-router",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "description": "A lightweight, type-safe routing library for React applications",
5
5
  "author": "Andrew Bubnov",
6
6
  "scripts": {