@tanstack/router-devtools 0.0.1-beta.204 → 0.0.1-beta.205
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 +16 -62
- package/build/cjs/devtools.js.map +1 -1
- package/build/cjs/utils.js +1 -2
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +18 -64
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +115 -223
- package/build/types/utils.d.ts +2 -2
- package/build/umd/index.development.js +45 -123
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -23
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/devtools.tsx +17 -21
- package/src/utils.ts +1 -9
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.205",
|
|
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.205"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "rollup --config rollup.config.js"
|
package/src/devtools.tsx
CHANGED
|
@@ -3,11 +3,12 @@ import {
|
|
|
3
3
|
routerContext,
|
|
4
4
|
invariant,
|
|
5
5
|
AnyRouter,
|
|
6
|
-
useStore,
|
|
6
|
+
// useStore,
|
|
7
7
|
Route,
|
|
8
8
|
AnyRoute,
|
|
9
9
|
AnyRootRoute,
|
|
10
10
|
trimPath,
|
|
11
|
+
useRouter,
|
|
11
12
|
} from '@tanstack/react-router'
|
|
12
13
|
|
|
13
14
|
import useLocalStorage from './useLocalStorage'
|
|
@@ -409,7 +410,6 @@ export function TanStackRouterDevtools({
|
|
|
409
410
|
function RouteComp({
|
|
410
411
|
route,
|
|
411
412
|
isRoot,
|
|
412
|
-
router,
|
|
413
413
|
activeRouteId,
|
|
414
414
|
activeMatchId,
|
|
415
415
|
setActiveRouteId,
|
|
@@ -417,13 +417,13 @@ function RouteComp({
|
|
|
417
417
|
}: {
|
|
418
418
|
route: AnyRootRoute | AnyRoute
|
|
419
419
|
isRoot?: boolean
|
|
420
|
-
router: AnyRouter
|
|
421
420
|
activeRouteId: string | undefined
|
|
422
421
|
activeMatchId: string | undefined
|
|
423
422
|
setActiveRouteId: (id: string) => void
|
|
424
423
|
setActiveMatchId: (id: string) => void
|
|
425
424
|
}) {
|
|
426
|
-
const
|
|
425
|
+
const router = useRouter()
|
|
426
|
+
const matches = [...router.state.pendingMatches, ...router.state.matches]
|
|
427
427
|
const match = router.state.matches.find((d) => d.routeId === route.id)
|
|
428
428
|
|
|
429
429
|
return (
|
|
@@ -493,7 +493,6 @@ function RouteComp({
|
|
|
493
493
|
<RouteComp
|
|
494
494
|
key={r.id}
|
|
495
495
|
route={r}
|
|
496
|
-
router={router}
|
|
497
496
|
activeRouteId={activeRouteId}
|
|
498
497
|
activeMatchId={activeMatchId}
|
|
499
498
|
setActiveRouteId={setActiveRouteId}
|
|
@@ -518,15 +517,15 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
518
517
|
...panelProps
|
|
519
518
|
} = props
|
|
520
519
|
|
|
521
|
-
const
|
|
522
|
-
const
|
|
520
|
+
const router = useRouter()
|
|
521
|
+
const matches = [...router.state.pendingMatches, ...router.state.matches]
|
|
523
522
|
|
|
524
523
|
invariant(
|
|
525
524
|
router,
|
|
526
525
|
'No router was found for the TanStack Router Devtools. Please place the devtools in the <RouterProvider> component tree or pass the router instance to the devtools manually.',
|
|
527
526
|
)
|
|
528
527
|
|
|
529
|
-
useStore(router.__store)
|
|
528
|
+
// useStore(router.__store)
|
|
530
529
|
|
|
531
530
|
const [showMatches, setShowMatches] = useLocalStorage(
|
|
532
531
|
'tanstackRouterDevtoolsShowMatches',
|
|
@@ -544,21 +543,19 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
544
543
|
|
|
545
544
|
const activeMatch = React.useMemo(
|
|
546
545
|
() =>
|
|
547
|
-
|
|
548
|
-
|
|
546
|
+
matches.find((d) => d.id === activeRouteId) ||
|
|
547
|
+
matches.find((d) => d.id === activeMatchId),
|
|
549
548
|
[activeRouteId, activeMatchId],
|
|
550
549
|
)
|
|
551
550
|
|
|
552
551
|
const hasSearch = Object.keys(router.state.location.search || {}).length
|
|
553
552
|
|
|
554
|
-
const preloadMatches =
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
},
|
|
561
|
-
)
|
|
553
|
+
// const preloadMatches = matches.filter((match) => {
|
|
554
|
+
// return (
|
|
555
|
+
// !state.matchIds.includes(match.id) &&
|
|
556
|
+
// !state.pendingMatchIds.includes(match.id)
|
|
557
|
+
// )
|
|
558
|
+
// })
|
|
562
559
|
|
|
563
560
|
// React.useEffect(() => {
|
|
564
561
|
// const interval = setInterval(() => {
|
|
@@ -812,7 +809,6 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
812
809
|
{!showMatches ? (
|
|
813
810
|
<RouteComp
|
|
814
811
|
route={router.routeTree}
|
|
815
|
-
router={router}
|
|
816
812
|
isRoot
|
|
817
813
|
activeRouteId={activeRouteId}
|
|
818
814
|
activeMatchId={activeMatchId}
|
|
@@ -872,7 +868,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
872
868
|
</div>
|
|
873
869
|
)}
|
|
874
870
|
</div>
|
|
875
|
-
{preloadMatches?.length ? (
|
|
871
|
+
{/* {preloadMatches?.length ? (
|
|
876
872
|
<div
|
|
877
873
|
style={{
|
|
878
874
|
flex: '1 1 auto',
|
|
@@ -944,7 +940,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
944
940
|
)
|
|
945
941
|
})}
|
|
946
942
|
</div>
|
|
947
|
-
) : null}
|
|
943
|
+
) : null} */}
|
|
948
944
|
</div>
|
|
949
945
|
{activeMatch ? (
|
|
950
946
|
<ActivePanel>
|
package/src/utils.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
AnyRootRoute,
|
|
4
|
-
AnyRoute,
|
|
5
|
-
AnyRouteMatch,
|
|
6
|
-
AnyRouter,
|
|
7
|
-
isMatchInvalid,
|
|
8
|
-
} from '@tanstack/react-router'
|
|
2
|
+
import { AnyRootRoute, AnyRoute, AnyRouteMatch } from '@tanstack/react-router'
|
|
9
3
|
|
|
10
4
|
import { Theme, useTheme } from './theme'
|
|
11
5
|
import useMediaQuery from './useMediaQuery'
|
|
@@ -34,8 +28,6 @@ type StyledComponent<T> = T extends 'button'
|
|
|
34
28
|
export function getStatusColor(match: AnyRouteMatch, theme: Theme) {
|
|
35
29
|
return match.status === 'pending' || match.isFetching
|
|
36
30
|
? theme.active
|
|
37
|
-
: isMatchInvalid(match)
|
|
38
|
-
? theme.warning
|
|
39
31
|
: match.status === 'error'
|
|
40
32
|
? theme.danger
|
|
41
33
|
: match.status === 'success'
|