@tanstack/router-devtools 0.0.1-beta.241 → 0.0.1-beta.243
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/devtools.js +12 -11
- package/build/cjs/devtools.js.map +1 -1
- package/build/esm/index.js +13 -12
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +295 -225
- package/build/umd/index.development.js +230 -15
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/devtools.tsx +20 -17
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/router-devtools",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "0.0.1-beta.
|
|
4
|
+
"version": "0.0.1-beta.243",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router/",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@babel/runtime": "^7.16.7",
|
|
43
43
|
"date-fns": "^2.29.1",
|
|
44
|
-
"@tanstack/react-router": "0.0.1-beta.
|
|
44
|
+
"@tanstack/react-router": "0.0.1-beta.243"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "rollup --config rollup.config.js"
|
package/src/devtools.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
AnyRootRoute,
|
|
8
8
|
trimPath,
|
|
9
9
|
useRouter,
|
|
10
|
+
useRouterState,
|
|
10
11
|
} from '@tanstack/react-router'
|
|
11
12
|
|
|
12
13
|
import useLocalStorage from './useLocalStorage'
|
|
@@ -416,13 +417,13 @@ function RouteComp({
|
|
|
416
417
|
activeRouteId: string | undefined
|
|
417
418
|
setActiveRouteId: (id: string) => void
|
|
418
419
|
}) {
|
|
419
|
-
const
|
|
420
|
+
const routerState = useRouterState()
|
|
420
421
|
const matches =
|
|
421
|
-
|
|
422
|
-
?
|
|
423
|
-
:
|
|
422
|
+
routerState.status === 'pending'
|
|
423
|
+
? routerState.pendingMatches ?? []
|
|
424
|
+
: routerState.matches
|
|
424
425
|
|
|
425
|
-
const match =
|
|
426
|
+
const match = routerState.matches.find((d) => d.routeId === route.id)
|
|
426
427
|
|
|
427
428
|
return (
|
|
428
429
|
<div>
|
|
@@ -513,9 +514,11 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
513
514
|
} = props
|
|
514
515
|
|
|
515
516
|
const router = useRouter()
|
|
517
|
+
const routerState = useRouterState()
|
|
518
|
+
|
|
516
519
|
const matches = [
|
|
517
|
-
...(
|
|
518
|
-
...
|
|
520
|
+
...(routerState.pendingMatches ?? []),
|
|
521
|
+
...routerState.matches,
|
|
519
522
|
]
|
|
520
523
|
|
|
521
524
|
invariant(
|
|
@@ -540,7 +543,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
540
543
|
[matches, activeRouteId],
|
|
541
544
|
)
|
|
542
545
|
|
|
543
|
-
const hasSearch = Object.keys(
|
|
546
|
+
const hasSearch = Object.keys(routerState.location.search || {}).length
|
|
544
547
|
|
|
545
548
|
// const preloadMatches = matches.filter((match) => {
|
|
546
549
|
// return (
|
|
@@ -710,7 +713,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
710
713
|
}}
|
|
711
714
|
>
|
|
712
715
|
Pathname{' '}
|
|
713
|
-
{
|
|
716
|
+
{routerState.location.maskedLocation ? (
|
|
714
717
|
<div
|
|
715
718
|
style={{
|
|
716
719
|
padding: '.1rem .5rem',
|
|
@@ -736,16 +739,16 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
736
739
|
opacity: 0.6,
|
|
737
740
|
}}
|
|
738
741
|
>
|
|
739
|
-
{
|
|
742
|
+
{routerState.location.pathname}
|
|
740
743
|
</code>
|
|
741
|
-
{
|
|
744
|
+
{routerState.location.maskedLocation ? (
|
|
742
745
|
<code
|
|
743
746
|
style={{
|
|
744
747
|
color: theme.warning,
|
|
745
748
|
fontWeight: 'bold',
|
|
746
749
|
}}
|
|
747
750
|
>
|
|
748
|
-
{
|
|
751
|
+
{routerState.location.maskedLocation.pathname}
|
|
749
752
|
</code>
|
|
750
753
|
) : null}
|
|
751
754
|
</div>
|
|
@@ -807,9 +810,9 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
807
810
|
/>
|
|
808
811
|
) : (
|
|
809
812
|
<div>
|
|
810
|
-
{(
|
|
811
|
-
?
|
|
812
|
-
:
|
|
813
|
+
{(routerState.status === 'pending'
|
|
814
|
+
? routerState.pendingMatches ?? []
|
|
815
|
+
: routerState.matches
|
|
813
816
|
).map((match, i) => {
|
|
814
817
|
return (
|
|
815
818
|
<div
|
|
@@ -1095,9 +1098,9 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
1095
1098
|
}}
|
|
1096
1099
|
>
|
|
1097
1100
|
<Explorer
|
|
1098
|
-
value={
|
|
1101
|
+
value={routerState.location.search || {}}
|
|
1099
1102
|
defaultExpanded={Object.keys(
|
|
1100
|
-
(
|
|
1103
|
+
(routerState.location.search as {}) || {},
|
|
1101
1104
|
).reduce((obj: any, next) => {
|
|
1102
1105
|
obj[next] = {}
|
|
1103
1106
|
return obj
|