@tanstack/react-router 0.0.1-alpha.5 → 0.0.1-alpha.6

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.
@@ -1247,7 +1247,6 @@ function createRouter(userOptions) {
1247
1247
  router.startedLoadingAt = id;
1248
1248
 
1249
1249
  if (next) {
1250
- // If the location.href has changed
1251
1250
  // Ingest the new location
1252
1251
  router.location = next;
1253
1252
  } // Clear out old actions
@@ -1492,7 +1491,7 @@ function createRouter(userOptions) {
1492
1491
  const unloadedMatchIds = router.matchRoutes(next.pathname).map(d => d.matchId);
1493
1492
  [...router.state.matches, ...((_router$state$pending5 = (_router$state$pending6 = router.state.pending) == null ? void 0 : _router$state$pending6.matches) != null ? _router$state$pending5 : [])].forEach(match => {
1494
1493
  if (unloadedMatchIds.includes(match.matchId)) {
1495
- match.isInvalid = true;
1494
+ match.invalidate();
1496
1495
  }
1497
1496
  });
1498
1497
  },
@@ -1539,7 +1538,8 @@ function createRouter(userOptions) {
1539
1538
  to = '.',
1540
1539
  search,
1541
1540
  hash,
1542
- replace
1541
+ replace,
1542
+ params
1543
1543
  } = _ref2;
1544
1544
  // If this link simply reloads the current route,
1545
1545
  // make sure it has a new key so it will trigger a data refresh
@@ -1559,7 +1559,9 @@ function createRouter(userOptions) {
1559
1559
  from: fromString,
1560
1560
  to: toString,
1561
1561
  search,
1562
- hash
1562
+ hash,
1563
+ replace,
1564
+ params
1563
1565
  });
1564
1566
  },
1565
1567
  buildLink: _ref3 => {
@@ -1897,6 +1899,9 @@ function createRouteMatch(router, route, opts) {
1897
1899
 
1898
1900
  routeMatch.__.cancelPending();
1899
1901
  },
1902
+ invalidate: () => {
1903
+ routeMatch.isInvalid = true;
1904
+ },
1900
1905
  load: async () => {
1901
1906
  const id = '' + Date.now() + Math.random();
1902
1907
  routeMatch.__.latestId = id; // If the match was in an error state, set it
@@ -2562,29 +2567,33 @@ function RouterProvider(_ref2) {
2562
2567
  value: router.state.matches
2563
2568
  }, children != null ? children : /*#__PURE__*/React.createElement(Outlet, null)));
2564
2569
  }
2570
+
2565
2571
  function useRouter() {
2566
2572
  const value = React.useContext(routerContext);
2567
2573
  warning(!value, 'useRouter must be used inside a <Router> component!');
2568
2574
  useRouterSubscription(value.router);
2569
2575
  return value.router;
2570
2576
  }
2577
+
2571
2578
  function useMatches() {
2572
2579
  return React.useContext(matchesContext);
2573
- }
2574
- function useParentMatches() {
2575
- const router = useRouter();
2576
-
2577
- const match = _useMatch();
2580
+ } // function useParentMatches(): RouteMatch[] {
2581
+ // const router = useRouter()
2582
+ // const match = useMatch()
2583
+ // const matches = router.state.matches
2584
+ // return matches.slice(
2585
+ // 0,
2586
+ // matches.findIndex((d) => d.matchId === match.matchId) - 1,
2587
+ // )
2588
+ // }
2578
2589
 
2579
- const matches = router.state.matches;
2580
- return matches.slice(0, matches.findIndex(d => d.matchId === match.matchId) - 1);
2581
- }
2582
2590
 
2583
2591
  function _useMatch() {
2584
2592
  var _useMatches;
2585
2593
 
2586
2594
  return (_useMatches = useMatches()) == null ? void 0 : _useMatches[0];
2587
2595
  }
2596
+
2588
2597
  function Outlet() {
2589
2598
  var _ref3, _childMatch$options$c;
2590
2599
 
@@ -2718,5 +2727,5 @@ function DefaultCatchBoundary(_ref6) {
2718
2727
  }, "If you are the owner of this website, it's highly recommended that you configure your own custom Catch/Error boundaries for the router. You can optionally configure a boundary for each route."));
2719
2728
  }
2720
2729
 
2721
- export { DefaultCatchBoundary, MatchesProvider, Outlet, RouterProvider, createBrowserHistory, createHashHistory, createMemoryHistory, createReactRouter, createRoute, createRouteConfig, createRouteMatch, createRouter, defaultParseSearch, defaultStringifySearch, functionalUpdate, invariant, last, matchByPath, matchPathname, parsePathname, parseSearchWith, replaceEqualDeep, _resolvePath as resolvePath, rootRouteId, stringifySearchWith, _useMatch as useMatch, useMatches, useParentMatches, useRouter, warning };
2730
+ export { DefaultCatchBoundary, MatchesProvider, Outlet, RouterProvider, createBrowserHistory, createHashHistory, createMemoryHistory, createReactRouter, createRoute, createRouteConfig, createRouteMatch, createRouter, defaultParseSearch, defaultStringifySearch, functionalUpdate, invariant, last, matchByPath, matchPathname, parsePathname, parseSearchWith, replaceEqualDeep, _resolvePath as resolvePath, rootRouteId, stringifySearchWith, warning };
2722
2731
  //# sourceMappingURL=index.js.map