@tinkoff/router 0.1.76 → 0.1.77
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/lib/index.browser.js +5 -2
- package/lib/index.es.js +5 -2
- package/lib/index.js +5 -2
- package/package.json +1 -1
package/lib/index.browser.js
CHANGED
|
@@ -772,8 +772,11 @@ class ClientRouter extends AbstractRouter {
|
|
|
772
772
|
// in case we didn't find any matched route just force hard page navigation
|
|
773
773
|
const prevUrl = (_b = (_a = navigation.fromUrl) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : window.location.href;
|
|
774
774
|
const nextUrl = navigation.url.href;
|
|
775
|
-
|
|
776
|
-
|
|
775
|
+
const isNoSpaNavigation = navigation.from && !navigation.to;
|
|
776
|
+
// prevent redirect cycle on the same page,
|
|
777
|
+
// except cases when we run no-spa navigations,
|
|
778
|
+
// because we need hard reload in this cases
|
|
779
|
+
if (isNoSpaNavigation ? true : prevUrl !== nextUrl) {
|
|
777
780
|
if (navigation.replace) {
|
|
778
781
|
window.location.replace(nextUrl);
|
|
779
782
|
}
|
package/lib/index.es.js
CHANGED
|
@@ -1002,8 +1002,11 @@ class ClientRouter extends AbstractRouter {
|
|
|
1002
1002
|
// in case we didn't find any matched route just force hard page navigation
|
|
1003
1003
|
const prevUrl = (_b = (_a = navigation.fromUrl) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : window.location.href;
|
|
1004
1004
|
const nextUrl = navigation.url.href;
|
|
1005
|
-
|
|
1006
|
-
|
|
1005
|
+
const isNoSpaNavigation = navigation.from && !navigation.to;
|
|
1006
|
+
// prevent redirect cycle on the same page,
|
|
1007
|
+
// except cases when we run no-spa navigations,
|
|
1008
|
+
// because we need hard reload in this cases
|
|
1009
|
+
if (isNoSpaNavigation ? true : prevUrl !== nextUrl) {
|
|
1007
1010
|
if (navigation.replace) {
|
|
1008
1011
|
window.location.replace(nextUrl);
|
|
1009
1012
|
}
|
package/lib/index.js
CHANGED
|
@@ -1017,8 +1017,11 @@ class ClientRouter extends AbstractRouter {
|
|
|
1017
1017
|
// in case we didn't find any matched route just force hard page navigation
|
|
1018
1018
|
const prevUrl = (_b = (_a = navigation.fromUrl) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : window.location.href;
|
|
1019
1019
|
const nextUrl = navigation.url.href;
|
|
1020
|
-
|
|
1021
|
-
|
|
1020
|
+
const isNoSpaNavigation = navigation.from && !navigation.to;
|
|
1021
|
+
// prevent redirect cycle on the same page,
|
|
1022
|
+
// except cases when we run no-spa navigations,
|
|
1023
|
+
// because we need hard reload in this cases
|
|
1024
|
+
if (isNoSpaNavigation ? true : prevUrl !== nextUrl) {
|
|
1022
1025
|
if (navigation.replace) {
|
|
1023
1026
|
window.location.replace(nextUrl);
|
|
1024
1027
|
}
|