@tanstack/react-router 0.0.1-beta.237 → 0.0.1-beta.239

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": "0.0.1-beta.237",
4
+ "version": "0.0.1-beta.239",
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": "0.0.1-beta.237"
47
+ "@tanstack/history": "0.0.1-beta.239"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "rollup --config rollup.config.js"
@@ -89,7 +89,8 @@ export function RouterProvider<
89
89
 
90
90
  const inner = (
91
91
  <routerContext.Provider value={router}>
92
- <RouterProviderInner<TRouteTree, TDehydrated> router={router} />
92
+ <Matches />
93
+ <Transitioner />
93
94
  </routerContext.Provider>
94
95
  )
95
96
 
@@ -100,18 +101,6 @@ export function RouterProvider<
100
101
  return inner
101
102
  }
102
103
 
103
- function RouterProviderInner<
104
- TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
105
- TDehydrated extends Record<string, any> = Record<string, any>,
106
- >({ router }: RouterProps<TRouteTree, TDehydrated>) {
107
- return (
108
- <>
109
- <Matches />
110
- <Transitioner />
111
- </>
112
- )
113
- }
114
-
115
104
  function Transitioner() {
116
105
  const router = useRouter()
117
106
  const routerState = useRouterState({
@@ -176,11 +165,11 @@ function Transitioner() {
176
165
 
177
166
  useLayoutEffect(() => {
178
167
  if (
168
+ routerState.isTransitioning &&
179
169
  !isTransitioning &&
180
170
  !routerState.isLoading &&
181
171
  routerState.resolvedLocation !== routerState.location
182
172
  ) {
183
- console.log('onResolved', routerState.location)
184
173
  router.emit({
185
174
  type: 'onResolved',
186
175
  fromLocation: routerState.resolvedLocation,
@@ -196,7 +185,13 @@ function Transitioner() {
196
185
  resolvedLocation: s.location,
197
186
  }))
198
187
  }
199
- }, [isTransitioning, routerState.isLoading])
188
+ }, [
189
+ routerState.isTransitioning,
190
+ isTransitioning,
191
+ routerState.isLoading,
192
+ routerState.resolvedLocation,
193
+ routerState.location,
194
+ ])
200
195
 
201
196
  useLayoutEffect(() => {
202
197
  if (!window.__TSR_DEHYDRATED__) {
package/src/router.ts CHANGED
@@ -1691,7 +1691,7 @@ export function getInitialRouterState(
1691
1691
  isLoading: false,
1692
1692
  isTransitioning: false,
1693
1693
  status: 'idle',
1694
- resolvedLocation: location,
1694
+ resolvedLocation: { ...location },
1695
1695
  location,
1696
1696
  matches: [],
1697
1697
  pendingMatches: [],