@tinkoff/router 0.3.18 → 0.3.21
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/router/abstract.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ export declare abstract class AbstractRouter {
|
|
|
65
65
|
protected redirect(navigation: Navigation, target: NavigateOptions): Promise<void>;
|
|
66
66
|
protected notfound(navigation: Navigation): Promise<void>;
|
|
67
67
|
protected block(navigation: Navigation): Promise<void>;
|
|
68
|
+
cancel(): Navigation | void;
|
|
68
69
|
protected normalizePathname(pathname?: string): string;
|
|
69
70
|
protected resolveUrl({ url, query, params, preserveQuery, hash }: NavigateOptions): Url;
|
|
70
71
|
protected resolveRoute({ url, params, navigateState }: {
|
package/lib/router/abstract.js
CHANGED
|
@@ -70,7 +70,7 @@ class Router extends ClientRouter {
|
|
|
70
70
|
}
|
|
71
71
|
commitNavigation(navigation) {
|
|
72
72
|
// if we have parallel navigation do not update current url, as it outdated anyway
|
|
73
|
-
if (navigation.cancelled) {
|
|
73
|
+
if (navigation.cancelled || navigation.skipped) {
|
|
74
74
|
logger.debug({
|
|
75
75
|
event: 'delay-ignore-commit',
|
|
76
76
|
navigation,
|
|
@@ -226,6 +226,18 @@ class Router extends ClientRouter {
|
|
|
226
226
|
catch (error) { }
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
+
cancel() {
|
|
230
|
+
if (!this.isNavigating())
|
|
231
|
+
return;
|
|
232
|
+
logger.debug({
|
|
233
|
+
event: 'cancelled',
|
|
234
|
+
navigation: this.currentNavigation,
|
|
235
|
+
});
|
|
236
|
+
const cancelled = this.currentNavigation;
|
|
237
|
+
this.currentNavigation.skipped = true;
|
|
238
|
+
this.currentNavigation = null;
|
|
239
|
+
return cancelled;
|
|
240
|
+
}
|
|
229
241
|
}
|
|
230
242
|
|
|
231
243
|
export { Router };
|
package/lib/router/browser.d.ts
CHANGED
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinkoff/router",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "router",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"use-sync-external-store": "^1.2.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@tramvai/core": "3.
|
|
30
|
+
"@tramvai/core": "3.15.1",
|
|
31
31
|
"react": ">=16.14.0",
|
|
32
32
|
"tslib": "^2.4.0"
|
|
33
33
|
},
|