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

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.49",
4
+ "version": "0.0.1-beta.56",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router/",
@@ -42,9 +42,6 @@
42
42
  "dependencies": {
43
43
  "@babel/runtime": "^7.16.7",
44
44
  "date-fns": "^2.29.1",
45
- "@tanstack/react-router": "0.0.1-beta.49"
46
- },
47
- "devDependencies": {
48
- "babel-plugin-transform-async-to-promises": "^0.8.18"
45
+ "@tanstack/react-router": "0.0.1-beta.56"
49
46
  }
50
47
  }
package/src/devtools.tsx CHANGED
@@ -440,25 +440,31 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
440
440
  setActiveMatchId('')
441
441
  }, [activeRouteId])
442
442
 
443
- const activeMatch =
444
- Object.values(router.store.state.matchCache)?.find(
445
- (d) => d.match.id === activeMatchId,
446
- )?.match ??
447
- router.store.state.currentMatches?.find((d) => d.route.id === activeRouteId)
448
-
449
- const matchCacheValues = multiSortBy(
450
- Object.keys(router.store.state.matchCache)
451
- .filter((key) => {
452
- const cacheEntry = router.store.state.matchCache[key]!
453
- return cacheEntry.gc > Date.now()
454
- })
455
- .map((key) => router.store.state.matchCache[key]!),
456
- [
457
- (d) => (d.match.store.state.isFetching ? -1 : 1),
458
- (d) => -d.match.store.state.updatedAt!,
443
+ const allMatches = React.useMemo(
444
+ () => [
445
+ ...Object.values(router.store.state.currentMatches),
446
+ ...Object.values(router.store.state.pendingMatches ?? []),
459
447
  ],
448
+ [router.store.state.currentMatches, router.store.state.pendingMatches],
460
449
  )
461
450
 
451
+ const activeMatch =
452
+ allMatches?.find((d) => d.id === activeMatchId) ||
453
+ allMatches?.find((d) => d.route.id === activeRouteId)
454
+
455
+ // const matchCacheValues = multiSortBy(
456
+ // Object.keys(router.store.state.matchCache)
457
+ // .filter((key) => {
458
+ // const cacheEntry = router.store.state.matchCache[key]!
459
+ // return cacheEntry.gc > Date.now()
460
+ // })
461
+ // .map((key) => router.store.state.matchCache[key]!),
462
+ // [
463
+ // (d) => (d.match.store.state.isFetching ? -1 : 1),
464
+ // (d) => -d.match.store.state.updatedAt!,
465
+ // ],
466
+ // )
467
+
462
468
  return (
463
469
  <ThemeProvider theme={theme}>
464
470
  <Panel ref={ref} className="TanStackRouterDevtoolsPanel" {...panelProps}>
@@ -703,7 +709,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
703
709
  })}
704
710
  </>
705
711
  ) : null}
706
- {matchCacheValues.length ? (
712
+ {/* {matchCacheValues.length ? (
707
713
  <>
708
714
  <div
709
715
  style={{
@@ -798,7 +804,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
798
804
  )
799
805
  })}
800
806
  </>
801
- ) : null}
807
+ ) : null} */}
802
808
  </div>
803
809
 
804
810
  {activeMatch ? (
@@ -834,10 +840,10 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
834
840
  <td style={{ opacity: '.5' }}>Status</td>
835
841
  <td>{activeMatch.store.state.status}</td>
836
842
  </tr>
837
- <tr>
843
+ {/* <tr>
838
844
  <td style={{ opacity: '.5' }}>Invalid</td>
839
845
  <td>{activeMatch.getIsInvalid().toString()}</td>
840
- </tr>
846
+ </tr> */}
841
847
  <tr>
842
848
  <td style={{ opacity: '.5' }}>Last Updated</td>
843
849
  <td>
@@ -868,18 +874,6 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
868
874
  padding: '0.5em',
869
875
  }}
870
876
  >
871
- <Button
872
- type="button"
873
- onClick={() => {
874
- activeMatch.invalidate()
875
- }}
876
- style={{
877
- background: theme.warning,
878
- color: theme.inputTextColor,
879
- }}
880
- >
881
- Invalidate
882
- </Button>{' '}
883
877
  <Button
884
878
  type="button"
885
879
  onClick={() => activeMatch.load()}
@@ -926,7 +920,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
926
920
  flexDirection: 'column',
927
921
  }}
928
922
  >
929
- <div
923
+ {/* <div
930
924
  style={{
931
925
  padding: '.5em',
932
926
  background: theme.backgroundAlt,
@@ -963,7 +957,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
963
957
  ) : (
964
958
  <em style={{ opacity: 0.5 }}>{'{ }'}</em>
965
959
  )}
966
- </div>
960
+ </div> */}
967
961
  <div
968
962
  style={{
969
963
  padding: '.5em',
package/src/utils.ts CHANGED
@@ -26,7 +26,7 @@ type StyledComponent<T> = T extends 'button'
26
26
  : never
27
27
 
28
28
  export function getStatusColor(match: RouteMatch, theme: Theme) {
29
- return match.store.state.isFetching
29
+ return match.store.state.status === 'pending'
30
30
  ? theme.active
31
31
  : match.store.state.status === 'error'
32
32
  ? theme.danger
@@ -35,16 +35,6 @@ export function getStatusColor(match: RouteMatch, theme: Theme) {
35
35
  : theme.gray
36
36
  }
37
37
 
38
- // export function getQueryStatusLabel(query: Query) {
39
- // return query.state.isFetching
40
- // ? 'fetching'
41
- // : !query.getObserversCount()
42
- // ? 'inactive'
43
- // : query.isStale()
44
- // ? 'stale'
45
- // : 'fresh'
46
- // }
47
-
48
38
  type Styles =
49
39
  | React.CSSProperties
50
40
  | ((props: Record<string, any>, theme: Theme) => React.CSSProperties)