@tanstack/react-router 1.0.5 → 1.0.7

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
3
  "author": "Tanner Linsley",
4
- "version": "1.0.5",
4
+ "version": "1.0.7",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
@@ -44,7 +44,7 @@
44
44
  "@tanstack/store": "^0.1.3",
45
45
  "tiny-invariant": "^1.3.1",
46
46
  "tiny-warning": "^1.0.3",
47
- "@tanstack/history": "1.0.5"
47
+ "@tanstack/history": "1.0.7"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "rollup --config rollup.config.js"
@@ -17,6 +17,15 @@ import { NoInfer, pick, useLayoutEffect } from './utils'
17
17
  import { MatchRouteOptions } from './Matches'
18
18
  import { RouteMatch } from './Matches'
19
19
 
20
+ const useTransition =
21
+ React.useTransition ||
22
+ (() => [
23
+ false,
24
+ (cb) => {
25
+ cb()
26
+ },
27
+ ])
28
+
20
29
  export interface CommitLocationOptions {
21
30
  replace?: boolean
22
31
  resetScroll?: boolean
@@ -108,7 +117,7 @@ function Transitioner() {
108
117
  pick(s, ['isLoading', 'location', 'resolvedLocation', 'isTransitioning']),
109
118
  })
110
119
 
111
- const [isTransitioning, startReactTransition] = React.useTransition()
120
+ const [isTransitioning, startReactTransition] = useTransition()
112
121
 
113
122
  router.startReactTransition = startReactTransition
114
123
 
@@ -165,10 +174,11 @@ function Transitioner() {
165
174
 
166
175
  useLayoutEffect(() => {
167
176
  if (
168
- routerState.isTransitioning &&
169
- !isTransitioning &&
170
- !routerState.isLoading &&
171
- routerState.resolvedLocation !== routerState.location
177
+ (React.useTransition as any)
178
+ ? routerState.isTransitioning && !isTransitioning
179
+ : true &&
180
+ !routerState.isLoading &&
181
+ routerState.resolvedLocation !== routerState.location
172
182
  ) {
173
183
  router.emit({
174
184
  type: 'onResolved',