@tanstack/react-router-devtools 0.0.1-alpha.3 → 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 = [],
@@ -1278,25 +1278,17 @@
1278
1278
  setValueSnapshot(value());
1279
1279
  };
1280
1280
 
1281
- return /*#__PURE__*/React__namespace.createElement(Entry, {
1282
- key: label
1283
- }, subEntryPages.length ? /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ExpandButton, {
1281
+ return /*#__PURE__*/React__namespace.createElement(Entry, null, subEntryPages.length ? /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ExpandButton, {
1284
1282
  onClick: () => toggleExpanded()
1285
1283
  }, /*#__PURE__*/React__namespace.createElement(Expander, {
1286
1284
  expanded: expanded
1287
- }), " ", 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, {
1288
- key: entry.label,
1289
- entry: entry
1290
- }))) : /*#__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", {
1291
1286
  key: index
1292
1287
  }, /*#__PURE__*/React__namespace.createElement(Entry, null, /*#__PURE__*/React__namespace.createElement(LabelButton, {
1293
1288
  onClick: () => setExpandedPages(old => old.includes(index) ? old.filter(d => d !== index) : [...old, index])
1294
1289
  }, /*#__PURE__*/React__namespace.createElement(Expander, {
1295
1290
  expanded: expanded
1296
- }), " [", index * pageSize, " ...", ' ', index * pageSize + pageSize - 1, "]"), expandedPages.includes(index) ? /*#__PURE__*/React__namespace.createElement(SubEntries, null, entries.map(entry => /*#__PURE__*/React__namespace.createElement(HandleEntry, {
1297
- key: entry.label,
1298
- entry: entry
1299
- }))) : 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, {
1300
1292
  renderer: renderer,
1301
1293
  label: /*#__PURE__*/React__namespace.createElement("button", {
1302
1294
  onClick: refreshValueSnapshot,
@@ -1363,15 +1355,11 @@
1363
1355
 
1364
1356
  const subEntryPages = chunkArray(subEntries, pageSize);
1365
1357
  return renderer(_extends({
1366
- HandleEntry: _ref5 => {
1367
- let {
1368
- entry
1369
- } = _ref5;
1370
- return /*#__PURE__*/React__namespace.createElement(Explorer, _extends({
1371
- value: value,
1372
- renderer: renderer
1373
- }, rest, entry));
1374
- },
1358
+ handleEntry: entry => /*#__PURE__*/React__namespace.createElement(Explorer, _extends({
1359
+ key: entry.label,
1360
+ value: value,
1361
+ renderer: renderer
1362
+ }, rest, entry)),
1375
1363
  type,
1376
1364
  subEntries,
1377
1365
  subEntryPages,
@@ -1667,17 +1655,33 @@
1667
1655
  panelProps = _objectWithoutPropertiesLoose(props, _excluded4);
1668
1656
 
1669
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];
1670
1664
  React__default["default"].useEffect(() => {
1671
1665
  let interval = setInterval(() => {
1672
- router.cleanPreloadCache();
1673
- router.notify();
1674
- }, 1000);
1666
+ router.cleanPreloadCache(); // router.notify()
1667
+
1668
+ rerender();
1669
+ }, 250);
1675
1670
  return () => {
1676
1671
  clearInterval(interval);
1677
1672
  };
1678
1673
  }, []);
1679
1674
  const [activeRouteId, setActiveRouteId] = useLocalStorage('tanstackRouterDevtoolsActiveRouteId', '');
1680
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]);
1681
1685
  return /*#__PURE__*/React__default["default"].createElement(ThemeProvider, {
1682
1686
  theme: defaultTheme
1683
1687
  }, /*#__PURE__*/React__default["default"].createElement(Panel, _extends({
@@ -1743,11 +1747,7 @@
1743
1747
  }
1744
1748
  }, /*#__PURE__*/React__default["default"].createElement(Explorer, {
1745
1749
  label: "Router",
1746
- value: (() => {
1747
- const rest = _objectWithoutPropertiesLoose(router, _excluded5);
1748
-
1749
- return rest;
1750
- })(),
1750
+ value: routerExplorerValue,
1751
1751
  defaultExpanded: {}
1752
1752
  })))), /*#__PURE__*/React__default["default"].createElement("div", {
1753
1753
  style: {
@@ -1975,11 +1975,7 @@
1975
1975
  }
1976
1976
  }, /*#__PURE__*/React__default["default"].createElement(Explorer, {
1977
1977
  label: "Match",
1978
- value: (() => {
1979
- const rest = _objectWithoutPropertiesLoose(activeMatch, _excluded6);
1980
-
1981
- return rest;
1982
- })(),
1978
+ value: activeMatchExplorerValue,
1983
1979
  defaultExpanded: {}
1984
1980
  }))) : null, /*#__PURE__*/React__default["default"].createElement("div", {
1985
1981
  style: {