@tinkoff/router 0.1.72 → 0.1.75
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 +12 -6
- package/lib/index.es.js +12 -6
- package/lib/index.js +12 -6
- package/package.json +4 -4
package/lib/index.browser.js
CHANGED
|
@@ -556,7 +556,7 @@ const wrapHistory = ({ onNavigate }) => {
|
|
|
556
556
|
const history = (delta) => {
|
|
557
557
|
go(delta);
|
|
558
558
|
};
|
|
559
|
-
const browserNavigate = (replace
|
|
559
|
+
const browserNavigate = (replace) => {
|
|
560
560
|
return (navigateState, title, url) => {
|
|
561
561
|
onNavigate({ url, replace, navigateState });
|
|
562
562
|
};
|
|
@@ -765,13 +765,19 @@ class ClientRouter extends AbstractRouter {
|
|
|
765
765
|
return super.resolveRoute(...options);
|
|
766
766
|
}
|
|
767
767
|
async notfound(navigation) {
|
|
768
|
+
var _a, _b;
|
|
768
769
|
await super.notfound(navigation);
|
|
769
770
|
// in case we didn't find any matched route just force hard page navigation
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
771
|
+
const prevUrl = (_b = (_a = navigation.fromUrl) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : window.location.href;
|
|
772
|
+
const nextUrl = navigation.url.href;
|
|
773
|
+
// prevent redirect cycle on the same page
|
|
774
|
+
if (prevUrl !== nextUrl) {
|
|
775
|
+
if (navigation.replace) {
|
|
776
|
+
window.location.replace(nextUrl);
|
|
777
|
+
}
|
|
778
|
+
else {
|
|
779
|
+
window.location.assign(nextUrl);
|
|
780
|
+
}
|
|
775
781
|
}
|
|
776
782
|
// prevent routing from any continues navigation returning promise which will be not resolved
|
|
777
783
|
return new Promise(() => { });
|
package/lib/index.es.js
CHANGED
|
@@ -786,7 +786,7 @@ const wrapHistory = ({ onNavigate }) => {
|
|
|
786
786
|
const history = (delta) => {
|
|
787
787
|
go(delta);
|
|
788
788
|
};
|
|
789
|
-
const browserNavigate = (replace
|
|
789
|
+
const browserNavigate = (replace) => {
|
|
790
790
|
return (navigateState, title, url) => {
|
|
791
791
|
onNavigate({ url, replace, navigateState });
|
|
792
792
|
};
|
|
@@ -995,13 +995,19 @@ class ClientRouter extends AbstractRouter {
|
|
|
995
995
|
return super.resolveRoute(...options);
|
|
996
996
|
}
|
|
997
997
|
async notfound(navigation) {
|
|
998
|
+
var _a, _b;
|
|
998
999
|
await super.notfound(navigation);
|
|
999
1000
|
// in case we didn't find any matched route just force hard page navigation
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1001
|
+
const prevUrl = (_b = (_a = navigation.fromUrl) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : window.location.href;
|
|
1002
|
+
const nextUrl = navigation.url.href;
|
|
1003
|
+
// prevent redirect cycle on the same page
|
|
1004
|
+
if (prevUrl !== nextUrl) {
|
|
1005
|
+
if (navigation.replace) {
|
|
1006
|
+
window.location.replace(nextUrl);
|
|
1007
|
+
}
|
|
1008
|
+
else {
|
|
1009
|
+
window.location.assign(nextUrl);
|
|
1010
|
+
}
|
|
1005
1011
|
}
|
|
1006
1012
|
// prevent routing from any continues navigation returning promise which will be not resolved
|
|
1007
1013
|
return new Promise(() => { });
|
package/lib/index.js
CHANGED
|
@@ -801,7 +801,7 @@ const wrapHistory = ({ onNavigate }) => {
|
|
|
801
801
|
const history = (delta) => {
|
|
802
802
|
go(delta);
|
|
803
803
|
};
|
|
804
|
-
const browserNavigate = (replace
|
|
804
|
+
const browserNavigate = (replace) => {
|
|
805
805
|
return (navigateState, title, url) => {
|
|
806
806
|
onNavigate({ url, replace, navigateState });
|
|
807
807
|
};
|
|
@@ -1010,13 +1010,19 @@ class ClientRouter extends AbstractRouter {
|
|
|
1010
1010
|
return super.resolveRoute(...options);
|
|
1011
1011
|
}
|
|
1012
1012
|
async notfound(navigation) {
|
|
1013
|
+
var _a, _b;
|
|
1013
1014
|
await super.notfound(navigation);
|
|
1014
1015
|
// in case we didn't find any matched route just force hard page navigation
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1016
|
+
const prevUrl = (_b = (_a = navigation.fromUrl) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : window.location.href;
|
|
1017
|
+
const nextUrl = navigation.url.href;
|
|
1018
|
+
// prevent redirect cycle on the same page
|
|
1019
|
+
if (prevUrl !== nextUrl) {
|
|
1020
|
+
if (navigation.replace) {
|
|
1021
|
+
window.location.replace(nextUrl);
|
|
1022
|
+
}
|
|
1023
|
+
else {
|
|
1024
|
+
window.location.assign(nextUrl);
|
|
1025
|
+
}
|
|
1020
1026
|
}
|
|
1021
1027
|
// prevent routing from any continues navigation returning promise which will be not resolved
|
|
1022
1028
|
return new Promise(() => { });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinkoff/router",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.75",
|
|
4
4
|
"description": "router",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"build-for-publish": "true"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@tinkoff/react-hooks": "0.0.
|
|
26
|
-
"@tinkoff/url": "0.7.
|
|
25
|
+
"@tinkoff/react-hooks": "0.0.26",
|
|
26
|
+
"@tinkoff/url": "0.7.38",
|
|
27
27
|
"@tinkoff/utils": "^2.1.2"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"react": ">=16.
|
|
30
|
+
"react": ">=16.14.0",
|
|
31
31
|
"tslib": "^2.0.3"
|
|
32
32
|
},
|
|
33
33
|
"sideEffects": false,
|