@tanstack/router-devtools 0.0.1-beta.213 → 0.0.1-beta.215

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/router-devtools",
3
3
  "author": "Tanner Linsley",
4
- "version": "0.0.1-beta.213",
4
+ "version": "0.0.1-beta.215",
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.213"
44
+ "@tanstack/react-router": "0.0.1-beta.215"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "rollup --config rollup.config.js"
package/src/devtools.tsx CHANGED
@@ -409,19 +409,19 @@ function RouteComp({
409
409
  route,
410
410
  isRoot,
411
411
  activeRouteId,
412
- activeMatchId,
413
412
  setActiveRouteId,
414
- setActiveMatchId,
415
413
  }: {
416
414
  route: AnyRootRoute | AnyRoute
417
415
  isRoot?: boolean
418
416
  activeRouteId: string | undefined
419
- activeMatchId: string | undefined
420
417
  setActiveRouteId: (id: string) => void
421
- setActiveMatchId: (id: string) => void
422
418
  }) {
423
419
  const router = useRouter()
424
- const matches = [...router.state.pendingMatches, ...router.state.matches]
420
+ const matches =
421
+ router.state.status === 'pending'
422
+ ? router.state.pendingMatches
423
+ : router.state.matches
424
+
425
425
  const match = router.state.matches.find((d) => d.routeId === route.id)
426
426
 
427
427
  return (
@@ -432,7 +432,6 @@ function RouteComp({
432
432
  onClick={() => {
433
433
  if (match) {
434
434
  setActiveRouteId(activeRouteId === route.id ? '' : route.id)
435
- setActiveMatchId(match.id)
436
435
  }
437
436
  }}
438
437
  style={{
@@ -492,9 +491,7 @@ function RouteComp({
492
491
  key={r.id}
493
492
  route={r}
494
493
  activeRouteId={activeRouteId}
495
- activeMatchId={activeMatchId}
496
494
  setActiveRouteId={setActiveRouteId}
497
- setActiveMatchId={setActiveMatchId}
498
495
  />
499
496
  ))}
500
497
  </div>
@@ -534,16 +531,10 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
534
531
  'tanstackRouterDevtoolsActiveRouteId',
535
532
  '',
536
533
  )
537
- const [activeMatchId, setActiveMatchId] = useLocalStorage(
538
- 'tanstackRouterDevtoolsActiveMatchId',
539
- '',
540
- )
541
534
 
542
535
  const activeMatch = React.useMemo(
543
- () =>
544
- matches.find((d) => d.id === activeRouteId) ||
545
- matches.find((d) => d.id === activeMatchId),
546
- [activeRouteId, activeMatchId],
536
+ () => matches.find((d) => d.routeId === activeRouteId),
537
+ [matches, activeRouteId],
547
538
  )
548
539
 
549
540
  const hasSearch = Object.keys(router.state.location.search || {}).length
@@ -809,13 +800,14 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
809
800
  route={router.routeTree}
810
801
  isRoot
811
802
  activeRouteId={activeRouteId}
812
- activeMatchId={activeMatchId}
813
803
  setActiveRouteId={setActiveRouteId}
814
- setActiveMatchId={setActiveMatchId}
815
804
  />
816
805
  ) : (
817
806
  <div>
818
- {router.state.matches.map((match, i) => {
807
+ {(router.state.status === 'pending'
808
+ ? router.state.pendingMatches
809
+ : router.state.matches
810
+ ).map((match, i) => {
819
811
  return (
820
812
  <div
821
813
  key={match.routeId || i}
@@ -1017,6 +1009,33 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
1017
1009
  Reload
1018
1010
  </Button>
1019
1011
  </div> */}
1012
+ {activeMatch.loaderData ? (
1013
+ <>
1014
+ <div
1015
+ style={{
1016
+ background: theme.backgroundAlt,
1017
+ padding: '.5em',
1018
+ position: 'sticky',
1019
+ top: 0,
1020
+ bottom: 0,
1021
+ zIndex: 1,
1022
+ }}
1023
+ >
1024
+ Loader Data
1025
+ </div>
1026
+ <div
1027
+ style={{
1028
+ padding: '.5em',
1029
+ }}
1030
+ >
1031
+ <Explorer
1032
+ label="loaderData"
1033
+ value={activeMatch.loaderData}
1034
+ defaultExpanded={{}}
1035
+ />
1036
+ </div>
1037
+ </>
1038
+ ) : null}
1020
1039
  <div
1021
1040
  style={{
1022
1041
  background: theme.backgroundAlt,