@tanstack/react-router-devtools 0.0.1-alpha.4 → 0.0.1-alpha.5

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.
@@ -1260,7 +1260,7 @@
1260
1260
  }
1261
1261
  const DefaultRenderer = _ref2 => {
1262
1262
  let {
1263
- HandleEntry,
1263
+ handleEntry,
1264
1264
  label,
1265
1265
  value,
1266
1266
  subEntries = [],
@@ -1282,19 +1282,13 @@
1282
1282
  onClick: () => toggleExpanded()
1283
1283
  }, /*#__PURE__*/React__namespace.createElement(Expander, {
1284
1284
  expanded: expanded
1285
- }), " ", label, ' ', /*#__PURE__*/React__namespace.createElement(Info, null, String(type).toLowerCase() === 'iterable' ? '(Iterable) ' : '', subEntries.length, " ", subEntries.length > 1 ? "items" : "item")), expanded ? subEntryPages.length === 1 ? /*#__PURE__*/React__namespace.createElement(SubEntries, null, subEntries.map(entry => /*#__PURE__*/React__namespace.createElement(HandleEntry, {
1286
- key: entry.label,
1287
- entry: entry
1288
- }))) : /*#__PURE__*/React__namespace.createElement(SubEntries, null, subEntryPages.map((entries, index) => /*#__PURE__*/React__namespace.createElement("div", {
1285
+ }), " ", label, ' ', /*#__PURE__*/React__namespace.createElement(Info, null, String(type).toLowerCase() === 'iterable' ? '(Iterable) ' : '', subEntries.length, " ", subEntries.length > 1 ? "items" : "item")), expanded ? subEntryPages.length === 1 ? /*#__PURE__*/React__namespace.createElement(SubEntries, null, subEntries.map((entry, index) => handleEntry(entry))) : /*#__PURE__*/React__namespace.createElement(SubEntries, null, subEntryPages.map((entries, index) => /*#__PURE__*/React__namespace.createElement("div", {
1289
1286
  key: index
1290
1287
  }, /*#__PURE__*/React__namespace.createElement(Entry, null, /*#__PURE__*/React__namespace.createElement(LabelButton, {
1291
1288
  onClick: () => setExpandedPages(old => old.includes(index) ? old.filter(d => d !== index) : [...old, index])
1292
1289
  }, /*#__PURE__*/React__namespace.createElement(Expander, {
1293
1290
  expanded: expanded
1294
- }), " [", index * pageSize, " ...", ' ', index * pageSize + pageSize - 1, "]"), expandedPages.includes(index) ? /*#__PURE__*/React__namespace.createElement(SubEntries, null, entries.map(entry => /*#__PURE__*/React__namespace.createElement(HandleEntry, {
1295
- key: entry.label,
1296
- entry: entry
1297
- }))) : null)))) : null) : type === 'function' ? /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Explorer, {
1291
+ }), " [", index * pageSize, " ...", ' ', index * pageSize + pageSize - 1, "]"), expandedPages.includes(index) ? /*#__PURE__*/React__namespace.createElement(SubEntries, null, entries.map(entry => handleEntry(entry))) : null)))) : null) : type === 'function' ? /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Explorer, {
1298
1292
  renderer: renderer,
1299
1293
  label: /*#__PURE__*/React__namespace.createElement("button", {
1300
1294
  onClick: refreshValueSnapshot,
@@ -1361,15 +1355,11 @@
1361
1355
 
1362
1356
  const subEntryPages = chunkArray(subEntries, pageSize);
1363
1357
  return renderer(_extends({
1364
- HandleEntry: React__namespace.useCallback(_ref5 => {
1365
- let {
1366
- entry
1367
- } = _ref5;
1368
- return /*#__PURE__*/React__namespace.createElement(Explorer, _extends({
1369
- value: value,
1370
- renderer: renderer
1371
- }, rest, entry));
1372
- }, [value, renderer]),
1358
+ handleEntry: entry => /*#__PURE__*/React__namespace.createElement(Explorer, _extends({
1359
+ key: entry.label,
1360
+ value: value,
1361
+ renderer: renderer
1362
+ }, rest, entry)),
1373
1363
  type,
1374
1364
  subEntries,
1375
1365
  subEntryPages,
@@ -1665,17 +1655,33 @@
1665
1655
  panelProps = _objectWithoutPropertiesLoose(props, _excluded4);
1666
1656
 
1667
1657
  const router = useRouter();
1658
+ const routerExplorerValue = React__default["default"].useMemo(() => {
1659
+ const rest = _objectWithoutPropertiesLoose(router, _excluded5);
1660
+
1661
+ return rest;
1662
+ }, [router.state]);
1663
+ const rerender = React__default["default"].useReducer(() => ({}), {})[1];
1668
1664
  React__default["default"].useEffect(() => {
1669
1665
  let interval = setInterval(() => {
1670
- router.cleanPreloadCache();
1671
- router.notify();
1672
- }, 1000);
1666
+ router.cleanPreloadCache(); // router.notify()
1667
+
1668
+ rerender();
1669
+ }, 250);
1673
1670
  return () => {
1674
1671
  clearInterval(interval);
1675
1672
  };
1676
1673
  }, []);
1677
1674
  const [activeRouteId, setActiveRouteId] = useLocalStorage('tanstackRouterDevtoolsActiveRouteId', '');
1678
1675
  const activeMatch = (_router$state$matches = router.state.matches) == null ? void 0 : _router$state$matches.find(d => d.routeId === activeRouteId);
1676
+ const activeMatchExplorerValue = React__default["default"].useMemo(() => {
1677
+ if (!activeMatch) {
1678
+ return {};
1679
+ }
1680
+
1681
+ const rest = _objectWithoutPropertiesLoose(activeMatch, _excluded6);
1682
+
1683
+ return rest;
1684
+ }, [activeMatch]);
1679
1685
  return /*#__PURE__*/React__default["default"].createElement(ThemeProvider, {
1680
1686
  theme: defaultTheme
1681
1687
  }, /*#__PURE__*/React__default["default"].createElement(Panel, _extends({
@@ -1741,11 +1747,7 @@
1741
1747
  }
1742
1748
  }, /*#__PURE__*/React__default["default"].createElement(Explorer, {
1743
1749
  label: "Router",
1744
- value: (() => {
1745
- const rest = _objectWithoutPropertiesLoose(router, _excluded5);
1746
-
1747
- return rest;
1748
- })(),
1750
+ value: routerExplorerValue,
1749
1751
  defaultExpanded: {}
1750
1752
  })))), /*#__PURE__*/React__default["default"].createElement("div", {
1751
1753
  style: {
@@ -1973,11 +1975,7 @@
1973
1975
  }
1974
1976
  }, /*#__PURE__*/React__default["default"].createElement(Explorer, {
1975
1977
  label: "Match",
1976
- value: (() => {
1977
- const rest = _objectWithoutPropertiesLoose(activeMatch, _excluded6);
1978
-
1979
- return rest;
1980
- })(),
1978
+ value: activeMatchExplorerValue,
1981
1979
  defaultExpanded: {}
1982
1980
  }))) : null, /*#__PURE__*/React__default["default"].createElement("div", {
1983
1981
  style: {