@tinkoff/router 0.7.73 → 0.7.106

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.
@@ -156,6 +156,12 @@ class AbstractRouter {
156
156
  getLastUrl() {
157
157
  return this.lastNavigation?.url;
158
158
  }
159
+ getCurrentNavigation() {
160
+ return this.currentNavigation;
161
+ }
162
+ getLastNavigation() {
163
+ return this.lastNavigation;
164
+ }
159
165
  commitNavigation(navigation) {
160
166
  logger.debug({
161
167
  event: 'commit-navigation',
@@ -104,6 +104,8 @@ export declare abstract class AbstractRouter {
104
104
  };
105
105
  getLastRoute(): NavigationRoute;
106
106
  getLastUrl(): Url;
107
+ getCurrentNavigation(): Navigation;
108
+ getLastNavigation(): Navigation;
107
109
  protected commitNavigation(navigation: Navigation): void;
108
110
  updateCurrentRoute(updateRouteOptions: UpdateCurrentRouteOptions): Promise<void>;
109
111
  protected internalUpdateCurrentRoute(updateRouteOptions: UpdateCurrentRouteOptions, { history }: InternalOptions): Promise<void>;
@@ -156,6 +156,12 @@ class AbstractRouter {
156
156
  getLastUrl() {
157
157
  return this.lastNavigation?.url;
158
158
  }
159
+ getCurrentNavigation() {
160
+ return this.currentNavigation;
161
+ }
162
+ getLastNavigation() {
163
+ return this.lastNavigation;
164
+ }
159
165
  commitNavigation(navigation) {
160
166
  logger.debug({
161
167
  event: 'commit-navigation',
@@ -165,6 +165,12 @@ class AbstractRouter {
165
165
  getLastUrl() {
166
166
  return this.lastNavigation?.url;
167
167
  }
168
+ getCurrentNavigation() {
169
+ return this.currentNavigation;
170
+ }
171
+ getLastNavigation() {
172
+ return this.lastNavigation;
173
+ }
168
174
  commitNavigation(navigation) {
169
175
  logger.logger.debug({
170
176
  event: 'commit-navigation',
@@ -4,7 +4,7 @@ import { RouteTree } from '../tree/tree.browser.js';
4
4
  import { NAVIGATION_TYPE } from './constants.browser.js';
5
5
 
6
6
  const DELAY_CHECK_INTERVAL = 50;
7
- const APPLIED_VIEW_TRANSITIONS_KEY = '_t_view_transitions_v2';
7
+ const APPLIED_VIEW_TRANSITIONS_KEY = '_t_view_transitions_v3';
8
8
  class Router extends ClientRouter {
9
9
  delayedNavigation;
10
10
  delayedPromise;
@@ -80,7 +80,8 @@ class Router extends ClientRouter {
80
80
  if (navigation.viewTransition) {
81
81
  // add transition except history navigations with VT enabled
82
82
  this.appliedViewTransitions.set(historyState.index, {
83
- path: from,
83
+ from,
84
+ to,
84
85
  viewTransitionTypes: navigation.viewTransitionTypes,
85
86
  });
86
87
  // if we have forward navigation without VT enabled and stored val for this index
@@ -286,7 +287,9 @@ class Router extends ClientRouter {
286
287
  if (result) {
287
288
  // can't be sure, but this check looks like replace state protection,
288
289
  // when we save a different route on the same index
289
- return result && result.path === target ? result : false;
290
+ return result && (isBrowserBackNavigation ? result.from === target : result.to === target)
291
+ ? result
292
+ : false;
290
293
  }
291
294
  return false;
292
295
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinkoff/router",
3
- "version": "0.7.73",
3
+ "version": "0.7.106",
4
4
  "description": "router",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "use-sync-external-store": "^1.4.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "@tramvai/core": "7.21.0",
31
+ "@tramvai/core": "7.26.8",
32
32
  "react": ">=16.14.0",
33
33
  "tslib": "^2.4.0"
34
34
  },