@tanstack/router-devtools 0.0.1-beta.173 → 0.0.1-beta.175

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.
@@ -115,6 +115,16 @@
115
115
  function trimPath(path) {
116
116
  return trimPathRight(trimPathLeft(path));
117
117
  }
118
+ function isMatchInvalid(match, opts) {
119
+ const now = Date.now();
120
+ if (match.invalid) {
121
+ return true;
122
+ }
123
+ if (opts?.preload) {
124
+ return match.preloadMaxAge < 0 ? false : match.updatedAt + match.preloadMaxAge < now;
125
+ }
126
+ return match.maxAge < 0 ? false : match.updatedAt + match.maxAge < now;
127
+ }
118
128
 
119
129
  /**
120
130
  * @tanstack/react-router/src/index.tsx
@@ -228,14 +238,12 @@
228
238
 
229
239
  const isServer$1 = typeof window === 'undefined';
230
240
  function getStatusColor(match, theme, router) {
231
- return match.status === 'pending' || match.isFetching ? theme.active : router.getIsInvalid({
232
- matchId: match.id
233
- }) ? theme.warning : match.status === 'error' ? theme.danger : match.status === 'success' ? theme.success : theme.gray;
241
+ return match.status === 'pending' || match.isFetching ? theme.active : isMatchInvalid(match) ? theme.warning : match.status === 'error' ? theme.danger : match.status === 'success' ? theme.success : theme.gray;
234
242
  }
235
243
  function getRouteStatusColor(matches, route, theme, router) {
236
244
  const found = matches.find(d => d.routeId === route.id);
237
245
  if (!found) return theme.gray;
238
- return getStatusColor(found, theme, router);
246
+ return getStatusColor(found, theme);
239
247
  }
240
248
  function styled(type, newStyles, queries = {}) {
241
249
  return /*#__PURE__*/React__default["default"].forwardRef(({
@@ -819,7 +827,7 @@
819
827
  fontWeight: 'bold',
820
828
  borderRadius: '100%',
821
829
  transition: 'all .2s ease-out',
822
- background: getRouteStatusColor(matches, route, defaultTheme, router),
830
+ background: getRouteStatusColor(matches, route, defaultTheme),
823
831
  opacity: match ? 1 : 0.3
824
832
  }
825
833
  }), /*#__PURE__*/React__default["default"].createElement(Code, {
@@ -873,12 +881,15 @@
873
881
  const preloadMatches = Object.values(router.state.matchesById).filter(match => {
874
882
  return !router.state.matchIds.includes(match.id) && !router.state.pendingMatchIds.includes(match.id);
875
883
  });
876
- React__default["default"].useEffect(() => {
877
- const interval = setInterval(() => {
878
- router.cleanMatches();
879
- }, 1000);
880
- return () => clearInterval(interval);
881
- }, [router]);
884
+
885
+ // React.useEffect(() => {
886
+ // const interval = setInterval(() => {
887
+ // router.cleanMatches()
888
+ // }, 1000)
889
+
890
+ // return () => clearInterval(interval)
891
+ // }, [router])
892
+
882
893
  return /*#__PURE__*/React__default["default"].createElement(ThemeProvider, {
883
894
  theme: defaultTheme
884
895
  }, /*#__PURE__*/React__default["default"].createElement(Panel, _extends({
@@ -1072,7 +1083,7 @@
1072
1083
  width: '1.3rem',
1073
1084
  height: '1.3rem',
1074
1085
  marginLeft: '.25rem',
1075
- background: getStatusColor(match, defaultTheme, router),
1086
+ background: getStatusColor(match, defaultTheme),
1076
1087
  alignItems: 'center',
1077
1088
  justifyContent: 'center',
1078
1089
  fontWeight: 'bold',
@@ -1121,7 +1132,7 @@
1121
1132
  width: '1.3rem',
1122
1133
  height: '1.3rem',
1123
1134
  marginLeft: '.25rem',
1124
- background: getStatusColor(match, defaultTheme, router),
1135
+ background: getStatusColor(match, defaultTheme),
1125
1136
  alignItems: 'center',
1126
1137
  justifyContent: 'center',
1127
1138
  fontWeight: 'bold',