@tanstack/router-core 0.0.1-beta.178 → 0.0.1-beta.180

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.
@@ -711,6 +711,7 @@ function stringifySearchWith(stringify, parser) {
711
711
  const componentTypes = ['component', 'errorComponent', 'pendingComponent'];
712
712
  const visibilityChangeEvent = 'visibilitychange';
713
713
  const focusEvent = 'focus';
714
+ const preloadWarning = 'Error preloading route! ☝️';
714
715
  class Router {
715
716
  #unsubHistory;
716
717
  resetNextScroll = false;
@@ -1439,14 +1440,14 @@ class Router {
1439
1440
  if (preload) {
1440
1441
  this.preloadRoute(nextOpts).catch(err => {
1441
1442
  console.warn(err);
1442
- console.warn('Error preloading route! ☝️');
1443
+ console.warn(preloadWarning);
1443
1444
  });
1444
1445
  }
1445
1446
  };
1446
1447
  const handleTouchStart = e => {
1447
1448
  this.preloadRoute(nextOpts).catch(err => {
1448
1449
  console.warn(err);
1449
- console.warn('Error preloading route! ☝️');
1450
+ console.warn(preloadWarning);
1450
1451
  });
1451
1452
  };
1452
1453
  const handleEnter = e => {
@@ -1459,7 +1460,7 @@ class Router {
1459
1460
  target.preloadTimeout = null;
1460
1461
  this.preloadRoute(nextOpts).catch(err => {
1461
1462
  console.warn(err);
1462
- console.warn('Error preloading route! ☝️');
1463
+ console.warn(preloadWarning);
1463
1464
  });
1464
1465
  }, preloadDelay);
1465
1466
  }
@@ -1486,6 +1487,7 @@ class Router {
1486
1487
  dehydrate = () => {
1487
1488
  return {
1488
1489
  state: {
1490
+ matchIds: this.state.matchIds,
1489
1491
  dehydratedMatches: this.state.matches.map(d => pick(d, ['fetchedAt', 'invalid', 'preloadMaxAge', 'maxAge', 'id', 'loaderData', 'status', 'updatedAt']))
1490
1492
  }
1491
1493
  };
@@ -1500,11 +1502,9 @@ class Router {
1500
1502
  const ctx = _ctx;
1501
1503
  this.dehydratedData = ctx.payload;
1502
1504
  this.options.hydrate?.(ctx.payload);
1503
- const {
1504
- dehydratedMatches
1505
- } = ctx.router.state;
1505
+ const dehydratedState = ctx.router.state;
1506
1506
  let matches = this.matchRoutes(this.state.location.pathname, this.state.location.search).map(match => {
1507
- const dehydratedMatch = dehydratedMatches.find(d => d.id === match.id);
1507
+ const dehydratedMatch = dehydratedState.dehydratedMatches.find(d => d.id === match.id);
1508
1508
  invariant(dehydratedMatch, `Could not find a client-side match for dehydrated match with id: ${match.id}!`);
1509
1509
  if (dehydratedMatch) {
1510
1510
  return {
@@ -1517,6 +1517,7 @@ class Router {
1517
1517
  this.__store.setState(s => {
1518
1518
  return {
1519
1519
  ...s,
1520
+ matchIds: dehydratedState.matchIds,
1520
1521
  matches,
1521
1522
  matchesById: this.#mergeMatches(s.matchesById, matches)
1522
1523
  };
@@ -1533,10 +1534,10 @@ class Router {
1533
1534
  const id = `__TSR_DEHYDRATED__${strKey}`;
1534
1535
  const data = typeof getData === 'function' ? await getData() : getData;
1535
1536
  return `<script id='${id}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${escapeJSON(strKey)}"] = ${JSON.stringify(data)}
1536
- // ;(() => {
1537
- // var el = document.getElementById('${id}')
1538
- // el.parentElement.removeChild(el)
1539
- // })()
1537
+ ;(() => {
1538
+ var el = document.getElementById('${id}')
1539
+ el.parentElement.removeChild(el)
1540
+ })()
1540
1541
  </script>`;
1541
1542
  });
1542
1543
  return () => this.hydrateData(key);