@akanjs/next 0.0.29 → 0.0.30
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.
- package/package.json +1 -1
- package/src/bootCsr.js +3 -2
- package/src/useCsrValues.js +1 -1
package/package.json
CHANGED
package/src/bootCsr.js
CHANGED
|
@@ -122,11 +122,12 @@ const bootCsr = async (context, rootPath, entryPath = "/route") => {
|
|
|
122
122
|
pathRoutes.forEach((pathRoute) => {
|
|
123
123
|
const pathSegments = pathRoute.pathSegments.slice(1);
|
|
124
124
|
pathSegments.reduce((routeGuide2, pathSegment, index) => {
|
|
125
|
+
const child = routeGuide2.children[pathSegment];
|
|
125
126
|
routeGuide2.children[pathSegment] = {
|
|
126
|
-
...
|
|
127
|
+
...child ?? {},
|
|
127
128
|
pathSegment,
|
|
128
129
|
...index === pathSegments.length - 1 ? { pathRoute } : {},
|
|
129
|
-
children:
|
|
130
|
+
children: child?.children ?? {}
|
|
130
131
|
};
|
|
131
132
|
return routeGuide2.children[pathSegment];
|
|
132
133
|
}, routeGuide);
|
package/src/useCsrValues.js
CHANGED
|
@@ -548,7 +548,7 @@ const useCsrValues = (rootRouteGuide, pathRoutes) => {
|
|
|
548
548
|
}
|
|
549
549
|
};
|
|
550
550
|
window.onpopstate = async (ev) => {
|
|
551
|
-
const routeType = window.location.pathname === getCurrentLocation().pathname ? "forward" : window.location.pathname === getPrevLocation()?.pathname ? "back" : null;
|
|
551
|
+
const routeType = window.location.pathname === getCurrentLocation().pathname && history.current.type !== "back" ? "forward" : window.location.pathname === getPrevLocation()?.pathname ? "back" : null;
|
|
552
552
|
const scrollTop = pageContentRef.current?.scrollTop ?? 0;
|
|
553
553
|
if (!routeType)
|
|
554
554
|
return;
|