@tanstack/router-devtools 0.0.1-beta.100 → 0.0.1-beta.101

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.100",
4
+ "version": "0.0.1-beta.101",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router/",
package/src/devtools.tsx CHANGED
@@ -412,27 +412,31 @@ function RouteComp({
412
412
  route,
413
413
  isRoot,
414
414
  matches,
415
+ activeRouteId,
416
+ setActiveRouteId,
415
417
  }: {
416
418
  route: AnyRootRoute | AnyRoute
417
419
  isRoot?: boolean
418
420
  matches: RouteMatch[]
421
+ activeRouteId: string | undefined
422
+ setActiveRouteId: (id: string) => void
419
423
  }) {
420
424
  const isActive = matches.find((d) => d.route === route)
421
425
  return (
422
426
  <div>
423
427
  <div
424
- // role="button"
425
- // aria-label={`Open match details for ${route.id}`}
426
- // onClick={() =>
427
- // setActiveRouteId(activeRouteId === route.id ? '' : route.id)
428
- // }
428
+ role="button"
429
+ aria-label={`Open match details for ${route.id}`}
430
+ onClick={() =>
431
+ setActiveRouteId(activeRouteId === route.id ? '' : route.id)
432
+ }
429
433
  style={{
430
434
  display: 'flex',
431
435
  borderBottom: `solid 1px ${theme.grayAlt}`,
432
436
  cursor: 'pointer',
433
437
  alignItems: 'center',
434
- // background:
435
- // route === activeMatch ? 'rgba(255,255,255,.1)' : undefined,
438
+ background:
439
+ route.id === activeRouteId ? 'rgba(255,255,255,.1)' : undefined,
436
440
  }}
437
441
  >
438
442
  {isRoot ? null : (
@@ -468,7 +472,13 @@ function RouteComp({
468
472
  }}
469
473
  >
470
474
  {(route.children as Route[]).map((r) => (
471
- <RouteComp key={r.id} route={r} matches={matches} />
475
+ <RouteComp
476
+ key={r.id}
477
+ route={r}
478
+ matches={matches}
479
+ activeRouteId={activeRouteId}
480
+ setActiveRouteId={setActiveRouteId}
481
+ />
472
482
  ))}
473
483
  </div>
474
484
  ) : null}
@@ -508,15 +518,6 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
508
518
  '',
509
519
  )
510
520
 
511
- const [activeMatchId, setActiveMatchId] = useLocalStorage(
512
- 'tanstackRouterDevtoolsActiveMatchId',
513
- '',
514
- )
515
-
516
- React.useEffect(() => {
517
- setActiveMatchId('')
518
- }, [activeRouteId])
519
-
520
521
  const allMatches: RouteMatch[] = React.useMemo(
521
522
  () => [
522
523
  ...Object.values(router.state.currentMatches),
@@ -525,9 +526,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
525
526
  [router.state.currentMatches, router.state.pendingMatches],
526
527
  )
527
528
 
528
- const activeMatch =
529
- allMatches?.find((d) => d.id === activeMatchId) ||
530
- allMatches?.find((d) => d.route.id === activeRouteId)
529
+ const activeMatch = allMatches?.find((d) => d.route.id === activeRouteId)
531
530
 
532
531
  const hasSearch = Object.keys(
533
532
  last(router.state.currentMatches)?.state.search || {},
@@ -698,7 +697,13 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
698
697
  </button>
699
698
  </div>
700
699
  {!showMatches ? (
701
- <RouteComp route={router.routeTree} isRoot matches={allMatches} />
700
+ <RouteComp
701
+ route={router.routeTree}
702
+ isRoot
703
+ matches={allMatches}
704
+ activeRouteId={activeRouteId}
705
+ setActiveRouteId={setActiveRouteId}
706
+ />
702
707
  ) : (
703
708
  <div>
704
709
  {router.state.currentMatches.map((match, i) => {