@tanstack/react-router 1.0.3 → 1.0.5
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/build/cjs/Matches.js +1 -0
- package/build/cjs/Matches.js.map +1 -1
- package/build/cjs/index.js +1 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/useParams.js +2 -1
- package/build/cjs/useParams.js.map +1 -1
- package/build/esm/index.js +2 -2
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +357 -351
- package/build/types/Matches.d.ts +2 -1
- package/build/umd/index.development.js +2 -1
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/Matches.tsx +1 -1
- package/src/useParams.tsx +2 -1
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.
|
|
4
|
+
"version": "1.0.5",
|
|
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.
|
|
47
|
+
"@tanstack/history": "1.0.5"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rollup --config rollup.config.js"
|
package/src/Matches.tsx
CHANGED
|
@@ -283,7 +283,7 @@ export function MatchRoute<
|
|
|
283
283
|
return !!params ? props.children : null
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
function getRenderedMatches(state: RouterState) {
|
|
286
|
+
export function getRenderedMatches(state: RouterState) {
|
|
287
287
|
return state.pendingMatches?.some((d) => d.showPending)
|
|
288
288
|
? state.pendingMatches
|
|
289
289
|
: state.matches
|
package/src/useParams.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { RegisteredRouter } from './router'
|
|
|
4
4
|
import { last } from './utils'
|
|
5
5
|
import { useRouterState } from './RouterProvider'
|
|
6
6
|
import { StrictOrFrom } from './utils'
|
|
7
|
+
import { getRenderedMatches } from './Matches'
|
|
7
8
|
|
|
8
9
|
export function useParams<
|
|
9
10
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
@@ -18,7 +19,7 @@ export function useParams<
|
|
|
18
19
|
): TSelected {
|
|
19
20
|
return useRouterState({
|
|
20
21
|
select: (state: any) => {
|
|
21
|
-
const params = (last(state
|
|
22
|
+
const params = (last(getRenderedMatches(state)) as any)?.params
|
|
22
23
|
return opts?.select ? opts.select(params) : params
|
|
23
24
|
},
|
|
24
25
|
})
|