@tanstack/react-router-devtools 0.0.1-beta.41 → 0.0.1-beta.49

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/react-router-devtools",
3
3
  "author": "Tanner Linsley",
4
- "version": "0.0.1-beta.41",
4
+ "version": "0.0.1-beta.49",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router/",
@@ -42,9 +42,9 @@
42
42
  "dependencies": {
43
43
  "@babel/runtime": "^7.16.7",
44
44
  "date-fns": "^2.29.1",
45
- "@tanstack/react-router": "workspace:^"
45
+ "@tanstack/react-router": "0.0.1-beta.49"
46
46
  },
47
47
  "devDependencies": {
48
48
  "babel-plugin-transform-async-to-promises": "^0.8.18"
49
49
  }
50
- }
50
+ }
package/src/devtools.tsx CHANGED
@@ -4,7 +4,6 @@ import {
4
4
  last,
5
5
  routerContext,
6
6
  invariant,
7
- __useStoreValue,
8
7
  useRouterStore,
9
8
  } from '@tanstack/react-router'
10
9
  import { formatDistanceStrict } from 'date-fns'
@@ -442,21 +441,21 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
442
441
  }, [activeRouteId])
443
442
 
444
443
  const activeMatch =
445
- Object.values(router.store.matchCache)?.find(
446
- (d) => d.match.matchId === activeMatchId,
444
+ Object.values(router.store.state.matchCache)?.find(
445
+ (d) => d.match.id === activeMatchId,
447
446
  )?.match ??
448
- router.store.currentMatches?.find((d) => d.routeId === activeRouteId)
447
+ router.store.state.currentMatches?.find((d) => d.route.id === activeRouteId)
449
448
 
450
449
  const matchCacheValues = multiSortBy(
451
- Object.keys(router.store.matchCache)
450
+ Object.keys(router.store.state.matchCache)
452
451
  .filter((key) => {
453
- const cacheEntry = router.store.matchCache[key]!
452
+ const cacheEntry = router.store.state.matchCache[key]!
454
453
  return cacheEntry.gc > Date.now()
455
454
  })
456
- .map((key) => router.store.matchCache[key]!),
455
+ .map((key) => router.store.state.matchCache[key]!),
457
456
  [
458
- (d) => (d.match.store.isFetching ? -1 : 1),
459
- (d) => -d.match.store.updatedAt!,
457
+ (d) => (d.match.store.state.isFetching ? -1 : 1),
458
+ (d) => -d.match.store.state.updatedAt!,
460
459
  ],
461
460
  )
462
461
 
@@ -597,15 +596,15 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
597
596
  >
598
597
  Active Matches
599
598
  </div>
600
- {router.store.currentMatches.map((match, i) => {
599
+ {router.store.state.currentMatches.map((match, i) => {
601
600
  return (
602
601
  <div
603
- key={match.routeId || i}
602
+ key={match.route.id || i}
604
603
  role="button"
605
- aria-label={`Open match details for ${match.routeId}`}
604
+ aria-label={`Open match details for ${match.route.id}`}
606
605
  onClick={() =>
607
606
  setActiveRouteId(
608
- activeRouteId === match.routeId ? '' : match.routeId,
607
+ activeRouteId === match.route.id ? '' : match.route.id,
609
608
  )
610
609
  }
611
610
  style={{
@@ -637,12 +636,12 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
637
636
  padding: '.5em',
638
637
  }}
639
638
  >
640
- {`${match.matchId}`}
639
+ {`${match.id}`}
641
640
  </Code>
642
641
  </div>
643
642
  )
644
643
  })}
645
- {router.store.pendingMatches?.length ? (
644
+ {router.store.state.pendingMatches?.length ? (
646
645
  <>
647
646
  <div
648
647
  style={{
@@ -656,15 +655,15 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
656
655
  >
657
656
  Pending Matches
658
657
  </div>
659
- {router.store.pendingMatches?.map((match, i) => {
658
+ {router.store.state.pendingMatches?.map((match, i) => {
660
659
  return (
661
660
  <div
662
- key={match.routeId || i}
661
+ key={match.route.id || i}
663
662
  role="button"
664
- aria-label={`Open match details for ${match.routeId}`}
663
+ aria-label={`Open match details for ${match.route.id}`}
665
664
  onClick={() =>
666
665
  setActiveRouteId(
667
- activeRouteId === match.routeId ? '' : match.routeId,
666
+ activeRouteId === match.route.id ? '' : match.route.id,
668
667
  )
669
668
  }
670
669
  style={{
@@ -697,7 +696,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
697
696
  padding: '.5em',
698
697
  }}
699
698
  >
700
- {`${match.matchId}`}
699
+ {`${match.id}`}
701
700
  </Code>
702
701
  </div>
703
702
  )
@@ -723,7 +722,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
723
722
  <div>Match Cache</div>
724
723
  <Button
725
724
  onClick={() => {
726
- router.setStore((s) => (s.matchCache = {}))
725
+ router.store.setState((s) => (s.matchCache = {}))
727
726
  }}
728
727
  >
729
728
  Clear
@@ -734,12 +733,12 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
734
733
 
735
734
  return (
736
735
  <div
737
- key={match.matchId || i}
736
+ key={match.id || i}
738
737
  role="button"
739
- aria-label={`Open match details for ${match.matchId}`}
738
+ aria-label={`Open match details for ${match.id}`}
740
739
  onClick={() =>
741
740
  setActiveMatchId(
742
- activeMatchId === match.matchId ? '' : match.matchId,
741
+ activeMatchId === match.id ? '' : match.id,
743
742
  )
744
743
  }
745
744
  style={{
@@ -780,7 +779,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
780
779
  transition: 'all .2s ease-out',
781
780
  }}
782
781
  />
783
- <Code>{`${match.matchId}`}</Code>
782
+ <Code>{`${match.id}`}</Code>
784
783
  </div>
785
784
  <span
786
785
  style={{
@@ -827,24 +826,24 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
827
826
  lineHeight: '1.8em',
828
827
  }}
829
828
  >
830
- {JSON.stringify(activeMatch.matchId, null, 2)}
829
+ {JSON.stringify(activeMatch.id, null, 2)}
831
830
  </Code>
832
831
  </td>
833
832
  </tr>
834
833
  <tr>
835
834
  <td style={{ opacity: '.5' }}>Status</td>
836
- <td>{activeMatch.store.status}</td>
835
+ <td>{activeMatch.store.state.status}</td>
837
836
  </tr>
838
837
  <tr>
839
838
  <td style={{ opacity: '.5' }}>Invalid</td>
840
- <td>{activeMatch.store.isInvalid.toString()}</td>
839
+ <td>{activeMatch.getIsInvalid().toString()}</td>
841
840
  </tr>
842
841
  <tr>
843
842
  <td style={{ opacity: '.5' }}>Last Updated</td>
844
843
  <td>
845
- {activeMatch.store.updatedAt
844
+ {activeMatch.store.state.updatedAt
846
845
  ? new Date(
847
- activeMatch.store.updatedAt as number,
846
+ activeMatch.store.state.updatedAt as number,
848
847
  ).toLocaleTimeString()
849
848
  : 'N/A'}
850
849
  </td>
@@ -945,15 +944,17 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
945
944
  }}
946
945
  >
947
946
  {Object.keys(
948
- last(router.store.currentMatches)?.store.loaderData || {},
947
+ last(router.store.state.currentMatches)?.store.state.loaderData ||
948
+ {},
949
949
  ).length ? (
950
950
  <Explorer
951
951
  value={
952
- last(router.store.currentMatches)?.store.loaderData || {}
952
+ last(router.store.state.currentMatches)?.store.state
953
+ .loaderData || {}
953
954
  }
954
955
  defaultExpanded={Object.keys(
955
- (last(router.store.currentMatches)?.store.loaderData as {}) ||
956
- {},
956
+ (last(router.store.state.currentMatches)?.store.state
957
+ .loaderData as {}) || {},
957
958
  ).reduce((obj: any, next) => {
958
959
  obj[next] = {}
959
960
  return obj
@@ -980,12 +981,17 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
980
981
  padding: '.5em',
981
982
  }}
982
983
  >
983
- {Object.keys(last(router.store.currentMatches)?.store.search || {})
984
- .length ? (
984
+ {Object.keys(
985
+ last(router.store.state.currentMatches)?.store.state.search || {},
986
+ ).length ? (
985
987
  <Explorer
986
- value={last(router.store.currentMatches)?.store.search || {}}
988
+ value={
989
+ last(router.store.state.currentMatches)?.store.state.search ||
990
+ {}
991
+ }
987
992
  defaultExpanded={Object.keys(
988
- (last(router.store.currentMatches)?.store.search as {}) || {},
993
+ (last(router.store.state.currentMatches)?.store.state
994
+ .search as {}) || {},
989
995
  ).reduce((obj: any, next) => {
990
996
  obj[next] = {}
991
997
  return obj
package/src/utils.ts CHANGED
@@ -26,11 +26,11 @@ type StyledComponent<T> = T extends 'button'
26
26
  : never
27
27
 
28
28
  export function getStatusColor(match: RouteMatch, theme: Theme) {
29
- return match.store.isFetching
29
+ return match.store.state.isFetching
30
30
  ? theme.active
31
- : match.store.status === 'error'
31
+ : match.store.state.status === 'error'
32
32
  ? theme.danger
33
- : match.store.status === 'success'
33
+ : match.store.state.status === 'success'
34
34
  ? theme.success
35
35
  : theme.gray
36
36
  }