Comparing version 7.0.2 to 7.0.3
@@ -5,2 +5,9 @@ # Changelog | ||
### [7.0.3](https://github.com/hybridsjs/hybrids/compare/v7.0.2...v7.0.3) (2021-12-17) | ||
### Bug Fixes | ||
* **router:** restore scroll restoration when navigate ([9a6e46b](https://github.com/hybridsjs/hybrids/commit/9a6e46b423ce62bba7c73e5830352d6ceeb916a5)) | ||
### [7.0.2](https://github.com/hybridsjs/hybrids/compare/v7.0.1...v7.0.2) (2021-12-16) | ||
@@ -7,0 +14,0 @@ |
@@ -160,5 +160,5 @@ # Usage | ||
If the current view is the only one on the stack, the first parent of the target view is used (going from left to right in the view hierarchy). The root views return an empty string. | ||
If the current view is the only one on the stack, the last parent of the target view is used (going from left to right in the view hierarchy). The root views always return an empty string. | ||
The `nested` option only applies if the previous and current views use nested routing. By default, the method will skip entries in the stack, where the main router view is the same, so it always returns the URL for another view. If the `nested` option is set to `true`, it generates the URL for the views from the deepest nested router. | ||
The `nested` option only applies if the previous and current view uses nested routing. By default, the method will skip entries in the stack, where the main router view is the same, so it always returns the URL for another view. If the `nested` option is set to `true`, it generates the URL for another view from the deepest nested router. | ||
@@ -165,0 +165,0 @@ ```javascript |
{ | ||
"name": "hybrids", | ||
"version": "7.0.2", | ||
"version": "7.0.3", | ||
"description": "A JavaScript framework for creating fully-featured web applications, components libraries, and single web components with unique declarative and functional architecture", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -831,5 +831,13 @@ import { callbacksMap } from "./define.js"; | ||
function connectRootRouter(host, invalidate, options) { | ||
function restoreScrollRestoration() { | ||
if (window.history.scrollRestoration === "manual") { | ||
window.history.scrollRestoration = "auto"; | ||
} | ||
} | ||
function flush() { | ||
resolveStack(host, window.history.state, options); | ||
invalidate(); | ||
requestAnimationFrame(restoreScrollRestoration); | ||
} | ||
@@ -858,4 +866,7 @@ | ||
if (pushOffset) { | ||
window.history.scrollRestoration = "manual"; | ||
} | ||
window.history[method](nextState, "", nextUrl); | ||
window.history.scrollRestoration = "auto"; | ||
@@ -865,4 +876,2 @@ flush(); | ||
window.history.scrollRestoration = "manual"; | ||
if (offset) { | ||
@@ -900,3 +909,6 @@ window.removeEventListener("popstate", flush); | ||
} | ||
window.history.scrollRestoration = "manual"; | ||
window.history.pushState([entry, ...state], "", url); | ||
flush(); | ||
@@ -903,0 +915,0 @@ } |
341457
4225