@tanstack/router-devtools 0.0.1-beta.242 → 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/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.242",
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.242"
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 router = useRouter()
420
+ const routerState = useRouterState()
420
421
  const matches =
421
- router.state.status === 'pending'
422
- ? router.state.pendingMatches ?? []
423
- : router.state.matches
422
+ routerState.status === 'pending'
423
+ ? routerState.pendingMatches ?? []
424
+ : routerState.matches
424
425
 
425
- const match = router.state.matches.find((d) => d.routeId === route.id)
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
- ...(router.state.pendingMatches ?? []),
518
- ...router.state.matches,
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(router.state.location.search || {}).length
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
- {router.state.location.maskedLocation ? (
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
- {router.state.location.pathname}
742
+ {routerState.location.pathname}
740
743
  </code>
741
- {router.state.location.maskedLocation ? (
744
+ {routerState.location.maskedLocation ? (
742
745
  <code
743
746
  style={{
744
747
  color: theme.warning,
745
748
  fontWeight: 'bold',
746
749
  }}
747
750
  >
748
- {router.state.location.maskedLocation.pathname}
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
- {(router.state.status === 'pending'
811
- ? router.state.pendingMatches ?? []
812
- : router.state.matches
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={router.state.location.search || {}}
1101
+ value={routerState.location.search || {}}
1099
1102
  defaultExpanded={Object.keys(
1100
- (router.state.location.search as {}) || {},
1103
+ (routerState.location.search as {}) || {},
1101
1104
  ).reduce((obj: any, next) => {
1102
1105
  obj[next] = {}
1103
1106
  return obj