@tanstack/router-devtools 0.0.1-alpha.0 → 0.0.1-beta.84

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.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/build/cjs/Explorer.js +57 -81
  4. package/build/cjs/Explorer.js.map +1 -1
  5. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -19
  6. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
  7. package/build/cjs/devtools.js +256 -266
  8. package/build/cjs/devtools.js.map +1 -1
  9. package/build/cjs/index.js +3 -3
  10. package/build/cjs/styledComponents.js +10 -38
  11. package/build/cjs/styledComponents.js.map +1 -1
  12. package/build/cjs/theme.js +5 -8
  13. package/build/cjs/theme.js.map +1 -1
  14. package/build/cjs/useLocalStorage.js +3 -10
  15. package/build/cjs/useLocalStorage.js.map +1 -1
  16. package/build/cjs/useMediaQuery.js +13 -12
  17. package/build/cjs/useMediaQuery.js.map +1 -1
  18. package/build/cjs/utils.js +25 -35
  19. package/build/cjs/utils.js.map +1 -1
  20. package/build/esm/index.js +308 -1337
  21. package/build/esm/index.js.map +1 -1
  22. package/build/stats-html.html +59 -49
  23. package/build/stats-react.json +223 -9444
  24. package/build/types/index.d.ts +6 -5
  25. package/build/umd/index.development.js +347 -1316
  26. package/build/umd/index.development.js.map +1 -1
  27. package/build/umd/index.production.js +22 -2
  28. package/build/umd/index.production.js.map +1 -1
  29. package/package.json +9 -11
  30. package/src/Explorer.tsx +14 -12
  31. package/src/devtools.tsx +263 -240
  32. package/src/useLocalStorage.ts +5 -5
  33. package/src/useMediaQuery.ts +3 -0
  34. package/src/utils.ts +35 -17
  35. package/build/cjs/Logo.js +0 -73
  36. package/build/cjs/Logo.js.map +0 -1
  37. package/build/cjs/packages/react-location-devtools/src/Explorer.js +0 -240
  38. package/build/cjs/packages/react-location-devtools/src/Explorer.js.map +0 -1
  39. package/build/cjs/packages/react-location-devtools/src/Logo.js +0 -73
  40. package/build/cjs/packages/react-location-devtools/src/Logo.js.map +0 -1
  41. package/build/cjs/packages/react-location-devtools/src/devtools.js +0 -614
  42. package/build/cjs/packages/react-location-devtools/src/devtools.js.map +0 -1
  43. package/build/cjs/packages/react-location-devtools/src/index.js +0 -21
  44. package/build/cjs/packages/react-location-devtools/src/index.js.map +0 -1
  45. package/build/cjs/packages/react-location-devtools/src/styledComponents.js +0 -107
  46. package/build/cjs/packages/react-location-devtools/src/styledComponents.js.map +0 -1
  47. package/build/cjs/packages/react-location-devtools/src/theme.js +0 -54
  48. package/build/cjs/packages/react-location-devtools/src/theme.js.map +0 -1
  49. package/build/cjs/packages/react-location-devtools/src/useLocalStorage.js +0 -65
  50. package/build/cjs/packages/react-location-devtools/src/useLocalStorage.js.map +0 -1
  51. package/build/cjs/packages/react-location-devtools/src/useMediaQuery.js +0 -57
  52. package/build/cjs/packages/react-location-devtools/src/useMediaQuery.js.map +0 -1
  53. package/build/cjs/packages/react-location-devtools/src/utils.js +0 -117
  54. package/build/cjs/packages/react-location-devtools/src/utils.js.map +0 -1
  55. package/build/cjs/packages/react-router-devtools/src/Explorer.js +0 -245
  56. package/build/cjs/packages/react-router-devtools/src/Explorer.js.map +0 -1
  57. package/build/cjs/packages/react-router-devtools/src/Logo.js +0 -73
  58. package/build/cjs/packages/react-router-devtools/src/Logo.js.map +0 -1
  59. package/build/cjs/packages/react-router-devtools/src/devtools.js +0 -654
  60. package/build/cjs/packages/react-router-devtools/src/devtools.js.map +0 -1
  61. package/build/cjs/packages/react-router-devtools/src/index.js +0 -21
  62. package/build/cjs/packages/react-router-devtools/src/index.js.map +0 -1
  63. package/build/cjs/packages/react-router-devtools/src/styledComponents.js +0 -107
  64. package/build/cjs/packages/react-router-devtools/src/styledComponents.js.map +0 -1
  65. package/build/cjs/packages/react-router-devtools/src/theme.js +0 -54
  66. package/build/cjs/packages/react-router-devtools/src/theme.js.map +0 -1
  67. package/build/cjs/packages/react-router-devtools/src/useLocalStorage.js +0 -65
  68. package/build/cjs/packages/react-router-devtools/src/useLocalStorage.js.map +0 -1
  69. package/build/cjs/packages/react-router-devtools/src/useMediaQuery.js +0 -57
  70. package/build/cjs/packages/react-router-devtools/src/useMediaQuery.js.map +0 -1
  71. package/build/cjs/packages/react-router-devtools/src/utils.js +0 -117
  72. package/build/cjs/packages/react-router-devtools/src/utils.js.map +0 -1
  73. package/src/Logo.tsx +0 -37
package/src/devtools.tsx CHANGED
@@ -1,14 +1,23 @@
1
1
  import React from 'react'
2
- import { Router, useRouter, last } from '@tanstack/react-router'
3
- import { formatDistanceStrict } from 'date-fns'
2
+ import {
3
+ last,
4
+ routerContext,
5
+ invariant,
6
+ AnyRouter,
7
+ useStore,
8
+ } from '@tanstack/router'
4
9
 
5
10
  import useLocalStorage from './useLocalStorage'
6
- import { getStatusColor, useIsMounted, useSafeState } from './utils'
11
+ import {
12
+ getStatusColor,
13
+ multiSortBy,
14
+ useIsMounted,
15
+ useSafeState,
16
+ } from './utils'
7
17
  import { Panel, Button, Code, ActivePanel } from './styledComponents'
8
18
  import { ThemeProvider, defaultTheme as theme } from './theme'
9
19
  // import { getQueryStatusLabel, getQueryStatusColor } from './utils'
10
20
  import Explorer from './Explorer'
11
- import Logo from './Logo'
12
21
 
13
22
  export type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
14
23
 
@@ -52,7 +61,7 @@ interface DevtoolsOptions {
52
61
  /**
53
62
  * A boolean variable indicating if the "lite" version of the library is being used
54
63
  */
55
- useRouter?: () => unknown
64
+ router?: AnyRouter
56
65
  }
57
66
 
58
67
  interface DevtoolsPanelOptions {
@@ -79,11 +88,53 @@ interface DevtoolsPanelOptions {
79
88
  /**
80
89
  * A boolean variable indicating if the "lite" version of the library is being used
81
90
  */
82
- useRouter: () => unknown
91
+ router?: AnyRouter
83
92
  }
84
93
 
85
94
  const isServer = typeof window === 'undefined'
86
95
 
96
+ function Logo(props: React.HTMLProps<HTMLDivElement>) {
97
+ return (
98
+ <div
99
+ {...props}
100
+ style={{
101
+ ...(props.style ?? {}),
102
+ display: 'flex',
103
+ alignItems: 'center',
104
+ flexDirection: 'column',
105
+ fontSize: '0.8rem',
106
+ fontWeight: 'bolder',
107
+ lineHeight: '1',
108
+ }}
109
+ >
110
+ <div
111
+ style={{
112
+ letterSpacing: '-0.05rem',
113
+ }}
114
+ >
115
+ TANSTACK
116
+ </div>
117
+ <div
118
+ style={{
119
+ backgroundImage:
120
+ 'linear-gradient(to right, var(--tw-gradient-stops))',
121
+ // @ts-ignore
122
+ '--tw-gradient-from': '#84cc16',
123
+ '--tw-gradient-stops':
124
+ 'var(--tw-gradient-from), var(--tw-gradient-to)',
125
+ '--tw-gradient-to': '#10b981',
126
+ WebkitBackgroundClip: 'text',
127
+ color: 'transparent',
128
+ letterSpacing: '0.1rem',
129
+ marginRight: '-0.2rem',
130
+ }}
131
+ >
132
+ ROUTER
133
+ </div>
134
+ </div>
135
+ )
136
+ }
137
+
87
138
  export function TanStackRouterDevtools({
88
139
  initialIsOpen,
89
140
  panelProps = {},
@@ -91,7 +142,7 @@ export function TanStackRouterDevtools({
91
142
  toggleButtonProps = {},
92
143
  position = 'bottom-left',
93
144
  containerElement: Container = 'footer',
94
- useRouter: useRouterImpl = useRouter,
145
+ router,
95
146
  }: DevtoolsOptions): React.ReactElement | null {
96
147
  const rootRef = React.useRef<HTMLDivElement>(null)
97
148
  const panelRef = React.useRef<HTMLDivElement>(null)
@@ -230,7 +281,7 @@ export function TanStackRouterDevtools({
230
281
  <TanStackRouterDevtoolsPanel
231
282
  ref={panelRef as any}
232
283
  {...otherPanelProps}
233
- useRouter={useRouterImpl}
284
+ router={router}
234
285
  style={{
235
286
  position: 'fixed',
236
287
  bottom: '0',
@@ -360,32 +411,46 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
360
411
  isOpen = true,
361
412
  setIsOpen,
362
413
  handleDragStart,
363
- useRouter,
414
+ router: userRouter,
364
415
  ...panelProps
365
416
  } = props
366
417
 
367
- const router = useRouter() as Router
418
+ const routerContextValue = React.useContext(routerContext)
419
+ const router = userRouter ?? routerContextValue?.router
368
420
 
369
- React.useEffect(() => {
370
- let interval = setInterval(() => {
371
- router.cleanPreloadCache()
372
- router.notify()
373
- }, 1000)
421
+ invariant(
422
+ router,
423
+ '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.',
424
+ )
374
425
 
375
- return () => {
376
- clearInterval(interval)
377
- }
378
- }, [])
426
+ useStore(router.__store)
379
427
 
380
428
  const [activeRouteId, setActiveRouteId] = useLocalStorage(
381
429
  'tanstackRouterDevtoolsActiveRouteId',
382
430
  '',
383
431
  )
384
432
 
385
- const activeMatch = router.state.matches?.find(
386
- (d) => d.routeId === activeRouteId,
433
+ const [activeMatchId, setActiveMatchId] = useLocalStorage(
434
+ 'tanstackRouterDevtoolsActiveMatchId',
435
+ '',
436
+ )
437
+
438
+ React.useEffect(() => {
439
+ setActiveMatchId('')
440
+ }, [activeRouteId])
441
+
442
+ const allMatches = React.useMemo(
443
+ () => [
444
+ ...Object.values(router.state.currentMatches),
445
+ ...Object.values(router.state.pendingMatches ?? []),
446
+ ],
447
+ [router.state.currentMatches, router.state.pendingMatches],
387
448
  )
388
449
 
450
+ const activeMatch =
451
+ allMatches?.find((d) => d.id === activeMatchId) ||
452
+ allMatches?.find((d) => d.route.id === activeRouteId)
453
+
389
454
  return (
390
455
  <ThemeProvider theme={theme}>
391
456
  <Panel ref={ref} className="TanStackRouterDevtoolsPanel" {...panelProps}>
@@ -462,27 +527,21 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
462
527
  >
463
528
  <div
464
529
  style={{
465
- padding: '.5em',
466
- background: theme.backgroundAlt,
467
530
  display: 'flex',
468
- justifyContent: 'space-between',
531
+ justifyContent: 'start',
532
+ gap: '1rem',
533
+ padding: '1rem',
469
534
  alignItems: 'center',
535
+ background: theme.backgroundAlt,
470
536
  }}
471
537
  >
472
- <Logo
473
- aria-hidden
474
- style={{
475
- marginRight: '.5em',
476
- }}
477
- />
538
+ <Logo aria-hidden />
478
539
  <div
479
540
  style={{
480
- marginRight: 'auto',
481
541
  fontSize: 'clamp(.8rem, 2vw, 1.3rem)',
482
542
  fontWeight: 'bold',
483
543
  }}
484
544
  >
485
- TanStack Router{' '}
486
545
  <span
487
546
  style={{
488
547
  fontWeight: 100,
@@ -503,34 +562,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
503
562
  padding: '.5em',
504
563
  }}
505
564
  >
506
- <Explorer
507
- label="Router"
508
- value={(() => {
509
- const {
510
- listeners,
511
- buildLocation,
512
- mount,
513
- update,
514
- buildNext,
515
- navigate,
516
- cancelMatches,
517
- loadLocation,
518
- cleanPreloadCache,
519
- loadRoute,
520
- matchRoutes,
521
- loadMatches,
522
- invalidateRoute,
523
- resolvePath,
524
- matchRoute,
525
- buildLink,
526
- __experimental__createSnapshot,
527
- destroy,
528
- ...rest
529
- } = router
530
- return rest
531
- })()}
532
- defaultExpanded={{}}
533
- />
565
+ <Explorer label="Router" value={router} defaultExpanded={{}} />
534
566
  </div>
535
567
  </div>
536
568
  </div>
@@ -554,17 +586,17 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
554
586
  zIndex: 1,
555
587
  }}
556
588
  >
557
- Current Matches
589
+ Active Matches
558
590
  </div>
559
- {router.state.matches.map((match, i) => {
591
+ {router.state.currentMatches.map((match, i) => {
560
592
  return (
561
593
  <div
562
- key={match.routeId || i}
594
+ key={match.route.id || i}
563
595
  role="button"
564
- aria-label={`Open match details for ${match.routeId}`}
596
+ aria-label={`Open match details for ${match.route.id}`}
565
597
  onClick={() =>
566
598
  setActiveRouteId(
567
- activeRouteId === match.routeId ? '' : match.routeId,
599
+ activeRouteId === match.route.id ? '' : match.route.id,
568
600
  )
569
601
  }
570
602
  style={{
@@ -596,158 +628,169 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
596
628
  padding: '.5em',
597
629
  }}
598
630
  >
599
- {`${match.matchId}`}
631
+ {`${match.id}`}
600
632
  </Code>
601
633
  </div>
602
634
  )
603
635
  })}
604
- <div
605
- style={{
606
- marginTop: '2rem',
607
- padding: '.5em',
608
- background: theme.backgroundAlt,
609
- position: 'sticky',
610
- top: 0,
611
- zIndex: 1,
612
- }}
613
- >
614
- Pending Matches
615
- </div>
616
- {router.state.pending?.matches.map((match, i) => {
617
- return (
636
+ {router.state.pendingMatches?.length ? (
637
+ <>
618
638
  <div
619
- key={match.routeId || i}
620
- role="button"
621
- aria-label={`Open match details for ${match.routeId}`}
622
- onClick={() =>
623
- setActiveRouteId(
624
- activeRouteId === match.routeId ? '' : match.routeId,
625
- )
626
- }
627
639
  style={{
628
- display: 'flex',
629
- borderBottom: `solid 1px ${theme.grayAlt}`,
630
- cursor: 'pointer',
631
- background:
632
- match === activeMatch ? 'rgba(255,255,255,.1)' : undefined,
640
+ marginTop: '2rem',
641
+ padding: '.5em',
642
+ background: theme.backgroundAlt,
643
+ position: 'sticky',
644
+ top: 0,
645
+ zIndex: 1,
633
646
  }}
634
647
  >
635
- <div
636
- style={{
637
- flex: '0 0 auto',
638
- width: '1.3rem',
639
- height: '1.3rem',
640
- marginLeft: '.25rem',
641
- background: getStatusColor(match, theme),
642
- alignItems: 'center',
643
- justifyContent: 'center',
644
- fontWeight: 'bold',
645
- borderRadius: '.25rem',
646
- transition: 'all .2s ease-out',
647
- }}
648
- />
648
+ Pending Matches
649
+ </div>
650
+ {router.state.pendingMatches?.map((match, i) => {
651
+ return (
652
+ <div
653
+ key={match.route.id || i}
654
+ role="button"
655
+ aria-label={`Open match details for ${match.route.id}`}
656
+ onClick={() =>
657
+ setActiveRouteId(
658
+ activeRouteId === match.route.id ? '' : match.route.id,
659
+ )
660
+ }
661
+ style={{
662
+ display: 'flex',
663
+ borderBottom: `solid 1px ${theme.grayAlt}`,
664
+ cursor: 'pointer',
665
+ background:
666
+ match === activeMatch
667
+ ? 'rgba(255,255,255,.1)'
668
+ : undefined,
669
+ }}
670
+ >
671
+ <div
672
+ style={{
673
+ flex: '0 0 auto',
674
+ width: '1.3rem',
675
+ height: '1.3rem',
676
+ marginLeft: '.25rem',
677
+ background: getStatusColor(match, theme),
678
+ alignItems: 'center',
679
+ justifyContent: 'center',
680
+ fontWeight: 'bold',
681
+ borderRadius: '.25rem',
682
+ transition: 'all .2s ease-out',
683
+ }}
684
+ />
649
685
 
650
- <Code
651
- style={{
652
- padding: '.5em',
686
+ <Code
687
+ style={{
688
+ padding: '.5em',
689
+ }}
690
+ >
691
+ {`${match.id}`}
692
+ </Code>
693
+ </div>
694
+ )
695
+ })}
696
+ </>
697
+ ) : null}
698
+ {/* {matchCacheValues.length ? (
699
+ <>
700
+ <div
701
+ style={{
702
+ marginTop: '2rem',
703
+ padding: '.5em',
704
+ background: theme.backgroundAlt,
705
+ position: 'sticky',
706
+ top: 0,
707
+ bottom: 0,
708
+ zIndex: 1,
709
+ display: 'flex',
710
+ alignItems: 'center',
711
+ justifyContent: 'space-between',
712
+ }}
713
+ >
714
+ <div>Match Cache</div>
715
+ <Button
716
+ onClick={() => {
717
+ router.store.setState((s) => (s.matchCache = {}))
653
718
  }}
654
719
  >
655
- {`${match.matchId}`}
656
- </Code>
720
+ Clear
721
+ </Button>
657
722
  </div>
658
- )
659
- })}
660
- <div
661
- style={{
662
- marginTop: '2rem',
663
- padding: '.5em',
664
- background: theme.backgroundAlt,
665
- position: 'sticky',
666
- top: 0,
667
- zIndex: 1,
668
- }}
669
- >
670
- Preloading Matches
671
- </div>
672
- {Object.keys(router.preloadCache)
673
- .filter((key) => {
674
- const cacheEntry = router.preloadCache[key]!
675
- return (
676
- (cacheEntry.match.updatedAt ?? Date.now()) + cacheEntry.maxAge >
677
- Date.now()
678
- )
679
- })
680
- .map((key, i) => {
681
- const { match, maxAge } = router.preloadCache[key]!
682
-
683
- return (
684
- <div
685
- key={match.matchId || i}
686
- role="button"
687
- aria-label={`Open match details for ${match.matchId}`}
688
- onClick={() =>
689
- setActiveRouteId(
690
- activeRouteId === match.routeId ? '' : match.routeId,
691
- )
692
- }
693
- style={{
694
- display: 'flex',
695
- borderBottom: `solid 1px ${theme.grayAlt}`,
696
- cursor: 'pointer',
697
- background:
698
- match === activeMatch
699
- ? 'rgba(255,255,255,.1)'
700
- : undefined,
701
- }}
702
- >
723
+ {matchCacheValues.map((d, i) => {
724
+ const { match, gc } = d
725
+
726
+ return (
703
727
  <div
728
+ key={match.id || i}
729
+ role="button"
730
+ aria-label={`Open match details for ${match.id}`}
731
+ onClick={() =>
732
+ setActiveMatchId(
733
+ activeMatchId === match.id ? '' : match.id,
734
+ )
735
+ }
704
736
  style={{
705
737
  display: 'flex',
706
- flexDirection: 'column',
707
- padding: '.5rem',
708
- gap: '.3rem',
738
+ borderBottom: `solid 1px ${theme.grayAlt}`,
739
+ cursor: 'pointer',
740
+ background:
741
+ match === activeMatch
742
+ ? 'rgba(255,255,255,.1)'
743
+ : undefined,
709
744
  }}
710
745
  >
711
746
  <div
712
747
  style={{
713
748
  display: 'flex',
714
- alignItems: 'center',
715
- gap: '.5rem',
749
+ flexDirection: 'column',
750
+ padding: '.5rem',
751
+ gap: '.3rem',
716
752
  }}
717
753
  >
718
754
  <div
719
755
  style={{
720
- flex: '0 0 auto',
721
- width: '1.3rem',
722
- height: '1.3rem',
723
- background: getStatusColor(match, theme),
756
+ display: 'flex',
724
757
  alignItems: 'center',
725
- justifyContent: 'center',
726
- fontWeight: 'bold',
727
- borderRadius: '.25rem',
728
- transition: 'all .2s ease-out',
758
+ gap: '.5rem',
729
759
  }}
730
- />
731
- <Code>{`${match.matchId}`}</Code>
732
- </div>
733
- <span
734
- style={{
735
- opacity: '.5',
736
- }}
737
- >
738
- Expires{' '}
739
- {formatDistanceStrict(
740
- new Date(),
741
- new Date((match.updatedAt ?? Date.now()) + maxAge),
742
- {
760
+ >
761
+ <div
762
+ style={{
763
+ flex: '0 0 auto',
764
+ width: '1.3rem',
765
+ height: '1.3rem',
766
+ background: getStatusColor(match, theme),
767
+ alignItems: 'center',
768
+ justifyContent: 'center',
769
+ fontWeight: 'bold',
770
+ borderRadius: '.25rem',
771
+ transition: 'all .2s ease-out',
772
+ }}
773
+ />
774
+ <Code>{`${match.id}`}</Code>
775
+ </div>
776
+ <span
777
+ style={{
778
+ fontSize: '.7rem',
779
+ opacity: '.5',
780
+ lineHeight: 1,
781
+ }}
782
+ >
783
+ Expires{' '}
784
+ {formatDistanceStrict(new Date(gc), new Date(), {
743
785
  addSuffix: true,
744
- },
745
- )}
746
- </span>
786
+ })}
787
+ </span>
788
+ </div>
747
789
  </div>
748
- </div>
749
- )
750
- })}
790
+ )
791
+ })}
792
+ </>
793
+ ) : null} */}
751
794
  </div>
752
795
 
753
796
  {activeMatch ? (
@@ -758,6 +801,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
758
801
  background: theme.backgroundAlt,
759
802
  position: 'sticky',
760
803
  top: 0,
804
+ bottom: 0,
761
805
  zIndex: 1,
762
806
  }}
763
807
  >
@@ -774,28 +818,24 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
774
818
  lineHeight: '1.8em',
775
819
  }}
776
820
  >
777
- {JSON.stringify(activeMatch.matchId, null, 2)}
821
+ {JSON.stringify(activeMatch.id, null, 2)}
778
822
  </Code>
779
823
  </td>
780
824
  </tr>
781
825
  <tr>
782
826
  <td style={{ opacity: '.5' }}>Status</td>
783
- <td>{activeMatch.status}</td>
784
- </tr>
785
- <tr>
786
- <td style={{ opacity: '.5' }}>Pending</td>
787
- <td>{activeMatch.isPending.toString()}</td>
827
+ <td>{activeMatch.state.status}</td>
788
828
  </tr>
789
- <tr>
829
+ {/* <tr>
790
830
  <td style={{ opacity: '.5' }}>Invalid</td>
791
- <td>{activeMatch.isInvalid.toString()}</td>
792
- </tr>
831
+ <td>{activeMatch.getIsInvalid().toString()}</td>
832
+ </tr> */}
793
833
  <tr>
794
834
  <td style={{ opacity: '.5' }}>Last Updated</td>
795
835
  <td>
796
- {activeMatch.updatedAt
836
+ {activeMatch.state.updatedAt
797
837
  ? new Date(
798
- activeMatch.updatedAt as number,
838
+ activeMatch.state.updatedAt as number,
799
839
  ).toLocaleTimeString()
800
840
  : 'N/A'}
801
841
  </td>
@@ -809,6 +849,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
809
849
  padding: '.5em',
810
850
  position: 'sticky',
811
851
  top: 0,
852
+ bottom: 0,
812
853
  zIndex: 1,
813
854
  }}
814
855
  >
@@ -821,20 +862,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
821
862
  >
822
863
  <Button
823
864
  type="button"
824
- onClick={() => {
825
- router.invalidateRoute(activeMatch as any)
826
- router.notify()
827
- }}
828
- style={{
829
- background: theme.warning,
830
- color: theme.inputTextColor,
831
- }}
832
- >
833
- Invalidate
834
- </Button>{' '}
835
- <Button
836
- type="button"
837
- onClick={() => router.reload()}
865
+ onClick={() => activeMatch.load()}
838
866
  style={{
839
867
  background: theme.gray,
840
868
  }}
@@ -848,6 +876,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
848
876
  padding: '.5em',
849
877
  position: 'sticky',
850
878
  top: 0,
879
+ bottom: 0,
851
880
  zIndex: 1,
852
881
  }}
853
882
  >
@@ -860,22 +889,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
860
889
  >
861
890
  <Explorer
862
891
  label="Match"
863
- value={(() => {
864
- const {
865
- cancel,
866
- load,
867
- router,
868
- Link,
869
- MatchRoute,
870
- buildLink,
871
- linkProps,
872
- matchRoute,
873
- navigate,
874
- ...rest
875
- } = activeMatch
876
-
877
- return rest
878
- })()}
892
+ value={activeMatch}
879
893
  defaultExpanded={{}}
880
894
  />
881
895
  </div>
@@ -892,28 +906,35 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
892
906
  flexDirection: 'column',
893
907
  }}
894
908
  >
895
- <div
909
+ {/* <div
896
910
  style={{
897
911
  padding: '.5em',
898
912
  background: theme.backgroundAlt,
899
913
  position: 'sticky',
900
914
  top: 0,
915
+ bottom: 0,
901
916
  zIndex: 1,
902
917
  }}
903
918
  >
904
- Loader Data
919
+ All Loader Data
905
920
  </div>
906
921
  <div
907
922
  style={{
908
923
  padding: '.5em',
909
924
  }}
910
925
  >
911
- {Object.keys(last(router.state.matches)?.loaderData || {})
912
- .length ? (
926
+ {Object.keys(
927
+ last(router.state.currentMatches)?.state.loaderData ||
928
+ {},
929
+ ).length ? (
913
930
  <Explorer
914
- value={last(router.state.matches)?.loaderData || {}}
931
+ value={
932
+ last(router.state.currentMatches)?.state
933
+ .loaderData || {}
934
+ }
915
935
  defaultExpanded={Object.keys(
916
- (last(router.state.matches)?.loaderData as {}) || {},
936
+ (last(router.state.currentMatches)?.state
937
+ .loaderData as {}) || {},
917
938
  ).reduce((obj: any, next) => {
918
939
  obj[next] = {}
919
940
  return obj
@@ -922,13 +943,14 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
922
943
  ) : (
923
944
  <em style={{ opacity: 0.5 }}>{'{ }'}</em>
924
945
  )}
925
- </div>
946
+ </div> */}
926
947
  <div
927
948
  style={{
928
949
  padding: '.5em',
929
950
  background: theme.backgroundAlt,
930
951
  position: 'sticky',
931
952
  top: 0,
953
+ bottom: 0,
932
954
  zIndex: 1,
933
955
  }}
934
956
  >
@@ -939,11 +961,12 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
939
961
  padding: '.5em',
940
962
  }}
941
963
  >
942
- {Object.keys(last(router.state.matches)?.search || {}).length ? (
964
+ {Object.keys(last(router.state.currentMatches)?.state.search || {})
965
+ .length ? (
943
966
  <Explorer
944
- value={last(router.state.matches)?.search || {}}
967
+ value={last(router.state.currentMatches)?.state.search || {}}
945
968
  defaultExpanded={Object.keys(
946
- (last(router.state.matches)?.search as {}) || {},
969
+ (last(router.state.currentMatches)?.state.search as {}) || {},
947
970
  ).reduce((obj: any, next) => {
948
971
  obj[next] = {}
949
972
  return obj