@tanstack/react-router 0.0.1-beta.34 → 0.0.1-beta.36

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.
@@ -1089,10 +1089,10 @@
1089
1089
  }
1090
1090
  function matchByPath(basepath, from, matchLocation) {
1091
1091
  var _matchLocation$to;
1092
- if (basepath && !from.startsWith(basepath)) {
1092
+ if (!from.startsWith(basepath)) {
1093
1093
  return undefined;
1094
1094
  }
1095
- from = from.startsWith(basepath) ? from.substring(basepath.length) : from;
1095
+ from = basepath != '/' ? from.substring(basepath.length) : from;
1096
1096
  const baseSegments = parsePathname(from);
1097
1097
  const to = "" + ((_matchLocation$to = matchLocation.to) != null ? _matchLocation$to : '*');
1098
1098
  const routeSegments = parsePathname(to);
@@ -1252,7 +1252,6 @@
1252
1252
  actionState.status = 'success';
1253
1253
  return res;
1254
1254
  } catch (err) {
1255
- console.log('tanner');
1256
1255
  console.error(err);
1257
1256
  actionState.error = err;
1258
1257
  actionState.status = 'error';
@@ -1406,7 +1405,7 @@
1406
1405
  validate: () => {
1407
1406
  var _routeMatch$parentMat, _routeMatch$parentMat2;
1408
1407
  // Validate the search params and stabilize them
1409
- const parentSearch = (_routeMatch$parentMat = (_routeMatch$parentMat2 = routeMatch.parentMatch) == null ? void 0 : _routeMatch$parentMat2.search) != null ? _routeMatch$parentMat : router.__location.search;
1408
+ const parentSearch = (_routeMatch$parentMat = (_routeMatch$parentMat2 = routeMatch.parentMatch) == null ? void 0 : _routeMatch$parentMat2.search) != null ? _routeMatch$parentMat : router.state.currentLocation.search;
1410
1409
  try {
1411
1410
  var _validator;
1412
1411
  const prevSearch = routeMatch.routeSearch;
@@ -1458,7 +1457,7 @@
1458
1457
  // If this is a preload, add it to the preload cache
1459
1458
  if (loaderOpts != null && loaderOpts.preload && minMaxAge > 0) {
1460
1459
  // If the match is currently active, don't preload it
1461
- if (router.state.matches.find(d => d.matchId === routeMatch.matchId)) {
1460
+ if (router.state.currentMatches.find(d => d.matchId === routeMatch.matchId)) {
1462
1461
  return;
1463
1462
  }
1464
1463
  router.matchCache[routeMatch.matchId] = {
@@ -1612,8 +1611,9 @@
1612
1611
  function getInitialRouterState() {
1613
1612
  return {
1614
1613
  status: 'idle',
1615
- location: null,
1616
- matches: [],
1614
+ latestLocation: null,
1615
+ currentLocation: null,
1616
+ currentMatches: [],
1617
1617
  actions: {},
1618
1618
  loaders: {},
1619
1619
  lastUpdated: Date.now(),
@@ -1644,7 +1644,6 @@
1644
1644
  basepath: '',
1645
1645
  routeTree: undefined,
1646
1646
  routesById: {},
1647
- __location: undefined,
1648
1647
  //
1649
1648
  resolveNavigation: () => {},
1650
1649
  matchCache: {},
@@ -1664,65 +1663,53 @@
1664
1663
  return router.routesById[id];
1665
1664
  },
1666
1665
  notify: () => {
1667
- const isFetching = router.state.status === 'loading' || router.state.matches.some(d => d.isFetching);
1668
- const isPreloading = Object.values(router.matchCache).some(d => d.match.isFetching && !router.state.matches.find(dd => dd.matchId === d.match.matchId));
1666
+ const isFetching = router.state.status === 'loading' || router.state.currentMatches.some(d => d.isFetching);
1667
+ const isPreloading = Object.values(router.matchCache).some(d => d.match.isFetching && !router.state.currentMatches.find(dd => dd.matchId === d.match.matchId));
1669
1668
  if (router.state.isFetching !== isFetching || router.state.isPreloading !== isPreloading) {
1670
1669
  router.state = _extends({}, router.state, {
1671
1670
  isFetching,
1672
1671
  isPreloading
1673
1672
  });
1674
1673
  }
1675
- cascadeLoaderData(router.state.matches);
1674
+ cascadeLoaderData(router.state.currentMatches);
1676
1675
  router.listeners.forEach(listener => listener(router));
1677
1676
  },
1678
1677
  dehydrate: () => {
1679
1678
  return {
1680
- location: router.__location,
1681
- state: _extends({}, pick(router.state, ['status', 'location', 'lastUpdated', 'location']), {
1682
- matches: router.state.matches.map(match => pick(match, ['matchId', 'status', 'routeLoaderData', 'loaderData', 'isInvalid', 'invalidAt']))
1679
+ state: _extends({}, pick(router.state, ['latestLocation', 'currentLocation', 'status', 'lastUpdated']), {
1680
+ currentMatches: router.state.currentMatches.map(match => pick(match, ['matchId', 'status', 'routeLoaderData', 'loaderData', 'isInvalid', 'invalidAt']))
1683
1681
  }),
1684
1682
  context: router.options.context
1685
1683
  };
1686
1684
  },
1687
1685
  hydrate: dehydratedState => {
1688
1686
  // Update the location
1689
- router.__location = dehydratedState.location;
1687
+ router.state.latestLocation = dehydratedState.state.latestLocation;
1688
+ router.state.currentLocation = dehydratedState.state.currentLocation;
1690
1689
 
1691
1690
  // Update the context
1692
1691
  router.options.context = dehydratedState.context;
1693
1692
 
1694
1693
  // Match the routes
1695
- const matches = router.matchRoutes(router.__location.pathname, {
1694
+ const currentMatches = router.matchRoutes(router.state.latestLocation.pathname, {
1696
1695
  strictParseParams: true
1697
1696
  });
1698
- matches.forEach((match, index) => {
1699
- const dehydratedMatch = dehydratedState.state.matches[index];
1697
+ currentMatches.forEach((match, index) => {
1698
+ const dehydratedMatch = dehydratedState.state.currentMatches[index];
1700
1699
  invariant(dehydratedMatch, 'Oh no! Dehydrated route matches did not match the active state of the router 😬');
1701
1700
  Object.assign(match, dehydratedMatch);
1702
1701
  });
1703
- matches.forEach(match => match.__.validate());
1702
+ currentMatches.forEach(match => match.__.validate());
1704
1703
  router.state = _extends({}, router.state, dehydratedState, {
1705
- matches
1704
+ currentMatches
1706
1705
  });
1707
1706
  },
1708
1707
  mount: () => {
1709
- router.__.buildLocation({
1710
- to: '.',
1711
- search: true,
1712
- hash: true
1713
- });
1714
-
1715
- // If the current location isn't updated, trigger a navigation
1716
- // to the current location. Otherwise, load the current location.
1717
- // if (next.href !== router.__location.href) {
1718
- // router.__.commitLocation(next, true)
1719
- // }
1720
-
1721
- if (!router.state.matches.length) {
1708
+ if (!router.state.currentMatches.length) {
1722
1709
  router.load();
1723
1710
  }
1724
1711
  const unsub = router.history.listen(event => {
1725
- router.load(router.__.parseLocation(event.location, router.__location));
1712
+ router.load(router.__.parseLocation(event.location, router.state.latestLocation));
1726
1713
  });
1727
1714
 
1728
1715
  // addEventListener does not exist in React Native, but window does
@@ -1747,12 +1734,12 @@
1747
1734
  update: opts => {
1748
1735
  var _trimPath;
1749
1736
  const newHistory = (opts == null ? void 0 : opts.history) !== router.history;
1750
- if (!router.__location || newHistory) {
1737
+ if (!router.state.latestLocation || newHistory) {
1751
1738
  if (opts != null && opts.history) {
1752
1739
  router.history = opts.history;
1753
1740
  }
1754
- router.__location = router.__.parseLocation(router.history.location);
1755
- router.state.location = router.__location;
1741
+ router.state.latestLocation = router.__.parseLocation(router.history.location);
1742
+ router.state.currentLocation = router.state.latestLocation;
1756
1743
  }
1757
1744
  Object.assign(router.options, opts);
1758
1745
  const {
@@ -1767,8 +1754,8 @@
1767
1754
  return router;
1768
1755
  },
1769
1756
  cancelMatches: () => {
1770
- var _router$state$pending, _router$state$pending2;
1771
- [...router.state.matches, ...((_router$state$pending = (_router$state$pending2 = router.state.pending) == null ? void 0 : _router$state$pending2.matches) != null ? _router$state$pending : [])].forEach(match => {
1757
+ var _router$state$pending;
1758
+ [...router.state.currentMatches, ...((_router$state$pending = router.state.pendingMatches) != null ? _router$state$pending : [])].forEach(match => {
1772
1759
  match.cancel();
1773
1760
  });
1774
1761
  },
@@ -1777,53 +1764,43 @@
1777
1764
  router.startedLoadingAt = id;
1778
1765
  if (next) {
1779
1766
  // Ingest the new location
1780
- router.__location = next;
1767
+ router.state.latestLocation = next;
1781
1768
  }
1782
1769
 
1783
1770
  // Cancel any pending matches
1784
1771
  router.cancelMatches();
1785
1772
 
1786
1773
  // Match the routes
1787
- const matches = router.matchRoutes(router.__location.pathname, {
1774
+ const matches = router.matchRoutes(router.state.latestLocation.pathname, {
1788
1775
  strictParseParams: true
1789
1776
  });
1790
1777
  if (typeof document !== 'undefined') {
1791
1778
  router.state = _extends({}, router.state, {
1792
- pending: {
1793
- matches: matches,
1794
- location: router.__location
1795
- },
1796
- status: 'loading'
1779
+ status: 'loading',
1780
+ pendingMatches: matches,
1781
+ pendingLocation: router.state.latestLocation
1797
1782
  });
1798
1783
  } else {
1799
1784
  router.state = _extends({}, router.state, {
1800
- matches: matches,
1801
- location: router.__location,
1802
- status: 'loading'
1785
+ status: 'loading',
1786
+ currentMatches: matches,
1787
+ currentLocation: router.state.latestLocation
1803
1788
  });
1804
1789
  }
1790
+ router.notify();
1805
1791
 
1806
- // Check if each match middleware to see if the route can be accessed
1792
+ // Load the matches
1807
1793
  try {
1808
- await Promise.all(matches.map(match => match.options.beforeLoad == null ? void 0 : match.options.beforeLoad({
1809
- router: router,
1810
- match
1811
- })));
1794
+ await router.loadMatches(matches);
1812
1795
  } catch (err) {
1813
- if (err != null && err.then) {
1814
- await new Promise(() => {});
1815
- }
1816
- throw err;
1796
+ console.log(err);
1797
+ invariant(false, 'Matches failed to load due to error above ☝️. Navigation cancelled!');
1817
1798
  }
1818
- router.notify();
1819
-
1820
- // Load the matches
1821
- await router.loadMatches(matches);
1822
1799
  if (router.startedLoadingAt !== id) {
1823
1800
  // Ignore side-effects of match loading
1824
1801
  return router.navigationPromise;
1825
1802
  }
1826
- const previousMatches = router.state.matches;
1803
+ const previousMatches = router.state.currentMatches;
1827
1804
  const exiting = [],
1828
1805
  staying = [];
1829
1806
  previousMatches.forEach(d => {
@@ -1882,10 +1859,11 @@
1882
1859
  }
1883
1860
  });
1884
1861
  router.state = _extends({}, router.state, {
1885
- location: router.__location,
1886
- matches,
1887
- pending: undefined,
1888
- status: 'idle'
1862
+ status: 'idle',
1863
+ currentLocation: router.state.latestLocation,
1864
+ currentMatches: matches,
1865
+ pendingLocation: undefined,
1866
+ pendingMatches: undefined
1889
1867
  });
1890
1868
  router.notify();
1891
1869
  router.resolveNavigation();
@@ -1911,7 +1889,7 @@
1911
1889
  },
1912
1890
  loadRoute: async function loadRoute(navigateOpts) {
1913
1891
  if (navigateOpts === void 0) {
1914
- navigateOpts = router.__location;
1892
+ navigateOpts = router.state.latestLocation;
1915
1893
  }
1916
1894
  const next = router.buildNext(navigateOpts);
1917
1895
  const matches = router.matchRoutes(next.pathname, {
@@ -1923,7 +1901,7 @@
1923
1901
  preloadRoute: async function preloadRoute(navigateOpts, loaderOpts) {
1924
1902
  var _ref3, _ref4, _loaderOpts$maxAge, _ref5, _ref6, _loaderOpts$gcMaxAge;
1925
1903
  if (navigateOpts === void 0) {
1926
- navigateOpts = router.__location;
1904
+ navigateOpts = router.state.latestLocation;
1927
1905
  }
1928
1906
  const next = router.buildNext(navigateOpts);
1929
1907
  const matches = router.matchRoutes(next.pathname, {
@@ -1937,13 +1915,13 @@
1937
1915
  return matches;
1938
1916
  },
1939
1917
  matchRoutes: (pathname, opts) => {
1940
- var _router$state$pending3, _router$state$pending4;
1918
+ var _router$state$pending2;
1941
1919
  router.cleanMatchCache();
1942
1920
  const matches = [];
1943
1921
  if (!router.routeTree) {
1944
1922
  return matches;
1945
1923
  }
1946
- const existingMatches = [...router.state.matches, ...((_router$state$pending3 = (_router$state$pending4 = router.state.pending) == null ? void 0 : _router$state$pending4.matches) != null ? _router$state$pending3 : [])];
1924
+ const existingMatches = [...router.state.currentMatches, ...((_router$state$pending2 = router.state.pendingMatches) != null ? _router$state$pending2 : [])];
1947
1925
  const recurse = async routes => {
1948
1926
  var _parentMatch$params, _router$options$filte, _foundRoute$childRout;
1949
1927
  const parentMatch = last(matches);
@@ -1962,6 +1940,15 @@
1962
1940
  fuzzy,
1963
1941
  caseSensitive: (_route$options$caseSe = route.options.caseSensitive) != null ? _route$options$caseSe : router.options.caseSensitive
1964
1942
  });
1943
+
1944
+ // console.log(
1945
+ // router.basepath,
1946
+ // route.fullPath,
1947
+ // fuzzy,
1948
+ // pathname,
1949
+ // matchParams,
1950
+ // )
1951
+
1965
1952
  if (matchParams) {
1966
1953
  let parsedParams;
1967
1954
  try {
@@ -2007,10 +1994,27 @@
2007
1994
  return matches;
2008
1995
  },
2009
1996
  loadMatches: async (resolvedMatches, loaderOpts) => {
2010
- const matchPromises = resolvedMatches.map(async match => {
2011
- var _search$__data;
1997
+ resolvedMatches.forEach(async match => {
2012
1998
  // Validate the match (loads search params etc)
2013
1999
  match.__.validate();
2000
+ });
2001
+
2002
+ // Check each match middleware to see if the route can be accessed
2003
+ await Promise.all(resolvedMatches.map(async match => {
2004
+ try {
2005
+ await (match.options.beforeLoad == null ? void 0 : match.options.beforeLoad({
2006
+ router: router,
2007
+ match
2008
+ }));
2009
+ } catch (err) {
2010
+ if (!(loaderOpts != null && loaderOpts.preload)) {
2011
+ match.options.onLoadError == null ? void 0 : match.options.onLoadError(err);
2012
+ }
2013
+ throw err;
2014
+ }
2015
+ }));
2016
+ const matchPromises = resolvedMatches.map(async match => {
2017
+ var _search$__data;
2014
2018
  const search = match.search;
2015
2019
  if ((_search$__data = search.__data) != null && _search$__data.matchId && search.__data.matchId !== match.matchId) {
2016
2020
  return;
@@ -2065,10 +2069,10 @@
2065
2069
  }
2066
2070
  },
2067
2071
  invalidateRoute: opts => {
2068
- var _router$state$pending5, _router$state$pending6;
2072
+ var _router$state$pending3;
2069
2073
  const next = router.buildNext(opts);
2070
2074
  const unloadedMatchIds = router.matchRoutes(next.pathname).map(d => d.matchId);
2071
- [...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 => {
2075
+ [...router.state.currentMatches, ...((_router$state$pending3 = router.state.pendingMatches) != null ? _router$state$pending3 : [])].forEach(match => {
2072
2076
  if (unloadedMatchIds.includes(match.matchId)) {
2073
2077
  match.invalidate();
2074
2078
  }
@@ -2091,15 +2095,14 @@
2091
2095
  });
2092
2096
  const next = router.buildNext(location);
2093
2097
  if (opts != null && opts.pending) {
2094
- var _router$state$pending7;
2095
- if (!((_router$state$pending7 = router.state.pending) != null && _router$state$pending7.location)) {
2098
+ if (!router.state.pendingLocation) {
2096
2099
  return false;
2097
2100
  }
2098
- return !!matchPathname(router.basepath, router.state.pending.location.pathname, _extends({}, opts, {
2101
+ return !!matchPathname(router.basepath, router.state.pendingLocation.pathname, _extends({}, opts, {
2099
2102
  to: next.pathname
2100
2103
  }));
2101
2104
  }
2102
- return !!matchPathname(router.basepath, router.state.location.pathname, _extends({}, opts, {
2105
+ return !!matchPathname(router.basepath, router.state.currentLocation.pathname, _extends({}, opts, {
2103
2106
  to: next.pathname
2104
2107
  }));
2105
2108
  },
@@ -2177,11 +2180,11 @@
2177
2180
  const preloadDelay = (_ref9 = userPreloadDelay != null ? userPreloadDelay : router.options.defaultPreloadDelay) != null ? _ref9 : 0;
2178
2181
 
2179
2182
  // Compare path/hash for matches
2180
- const pathIsEqual = router.state.location.pathname === next.pathname;
2181
- const currentPathSplit = router.state.location.pathname.split('/');
2183
+ const pathIsEqual = router.state.currentLocation.pathname === next.pathname;
2184
+ const currentPathSplit = router.state.currentLocation.pathname.split('/');
2182
2185
  const nextPathSplit = next.pathname.split('/');
2183
2186
  const pathIsFuzzyEqual = nextPathSplit.every((d, i) => d === currentPathSplit[i]);
2184
- const hashIsEqual = router.state.location.hash === next.hash;
2187
+ const hashIsEqual = router.state.currentLocation.hash === next.hash;
2185
2188
  // Combine the matches based on user options
2186
2189
  const pathTest = activeOptions != null && activeOptions.exact ? pathIsEqual : pathIsFuzzyEqual;
2187
2190
  const hashTest = activeOptions != null && activeOptions.includeHash ? hashIsEqual : true;
@@ -2208,6 +2211,9 @@
2208
2211
  router.preloadRoute(nextOpts, {
2209
2212
  maxAge: userPreloadMaxAge,
2210
2213
  gcMaxAge: userPreloadGcMaxAge
2214
+ }).catch(err => {
2215
+ console.log(err);
2216
+ console.warn('Error preloading route! ☝️');
2211
2217
  });
2212
2218
  }
2213
2219
  };
@@ -2222,6 +2228,9 @@
2222
2228
  router.preloadRoute(nextOpts, {
2223
2229
  maxAge: userPreloadMaxAge,
2224
2230
  gcMaxAge: userPreloadGcMaxAge
2231
+ }).catch(err => {
2232
+ console.log(err);
2233
+ console.warn('Error preloading route! ☝️');
2225
2234
  });
2226
2235
  }, preloadDelay);
2227
2236
  }
@@ -2304,9 +2313,9 @@
2304
2313
  if (dest === void 0) {
2305
2314
  dest = {};
2306
2315
  }
2307
- const fromPathname = dest.fromCurrent ? router.__location.pathname : (_dest$from = dest.from) != null ? _dest$from : router.__location.pathname;
2316
+ const fromPathname = dest.fromCurrent ? router.state.latestLocation.pathname : (_dest$from = dest.from) != null ? _dest$from : router.state.latestLocation.pathname;
2308
2317
  let pathname = resolvePath((_router$basepath = router.basepath) != null ? _router$basepath : '/', fromPathname, "" + ((_dest$to = dest.to) != null ? _dest$to : '.'));
2309
- const fromMatches = router.matchRoutes(router.__location.pathname, {
2318
+ const fromMatches = router.matchRoutes(router.state.latestLocation.pathname, {
2310
2319
  strictParseParams: true
2311
2320
  });
2312
2321
  const toMatches = router.matchRoutes(pathname);
@@ -2320,7 +2329,7 @@
2320
2329
  pathname = interpolatePath(pathname, nextParams != null ? nextParams : {});
2321
2330
 
2322
2331
  // Pre filters first
2323
- const preFilteredSearch = (_dest$__preSearchFilt = dest.__preSearchFilters) != null && _dest$__preSearchFilt.length ? dest.__preSearchFilters.reduce((prev, next) => next(prev), router.__location.search) : router.__location.search;
2332
+ const preFilteredSearch = (_dest$__preSearchFilt = dest.__preSearchFilters) != null && _dest$__preSearchFilt.length ? dest.__preSearchFilters.reduce((prev, next) => next(prev), router.state.latestLocation.search) : router.state.latestLocation.search;
2324
2333
 
2325
2334
  // Then the link/navigate function
2326
2335
  const destSearch = dest.search === true ? preFilteredSearch // Preserve resolvedFrom true
@@ -2330,15 +2339,15 @@
2330
2339
 
2331
2340
  // Then post filters
2332
2341
  const postFilteredSearch = (_dest$__postSearchFil = dest.__postSearchFilters) != null && _dest$__postSearchFil.length ? dest.__postSearchFilters.reduce((prev, next) => next(prev), destSearch) : destSearch;
2333
- const search = replaceEqualDeep(router.__location.search, postFilteredSearch);
2342
+ const search = replaceEqualDeep(router.state.latestLocation.search, postFilteredSearch);
2334
2343
  const searchStr = router.options.stringifySearch(search);
2335
- let hash = dest.hash === true ? router.__location.hash : functionalUpdate(dest.hash, router.__location.hash);
2344
+ let hash = dest.hash === true ? router.state.latestLocation.hash : functionalUpdate(dest.hash, router.state.latestLocation.hash);
2336
2345
  hash = hash ? "#" + hash : '';
2337
2346
  return {
2338
2347
  pathname,
2339
2348
  search,
2340
2349
  searchStr,
2341
- state: router.__location.state,
2350
+ state: router.state.latestLocation.state,
2342
2351
  hash,
2343
2352
  href: "" + pathname + searchStr + hash,
2344
2353
  key: dest.key
@@ -2567,7 +2576,7 @@
2567
2576
  useRouterSubscription(router);
2568
2577
  invariant(routeId !== rootRouteId, "\"" + rootRouteId + "\" cannot be used with useMatch! Did you mean to useRoute(\"" + rootRouteId + "\")?");
2569
2578
  const nearestMatch = useNearestMatch();
2570
- const match = router.state.matches.find(d => d.routeId === routeId);
2579
+ const match = router.state.currentMatches.find(d => d.routeId === routeId);
2571
2580
  if ((_opts$strict = opts == null ? void 0 : opts.strict) != null ? _opts$strict : true) {
2572
2581
  invariant(match, "Could not find an active match for \"" + routeId + "\"!");
2573
2582
  invariant(nearestMatch.routeId == (match == null ? void 0 : match.routeId), "useMatch(\"" + (match == null ? void 0 : match.routeId) + "\") is being called in a component that is meant to render the '" + nearestMatch.routeId + "' route. Did you mean to 'useMatch(\"" + (match == null ? void 0 : match.routeId) + "\", { strict: false })' or 'useRoute(\"" + (match == null ? void 0 : match.routeId) + "\")' instead?");
@@ -2612,7 +2621,7 @@
2612
2621
  router: router
2613
2622
  }
2614
2623
  }, /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
2615
- value: [undefined, ...router.state.matches]
2624
+ value: [undefined, ...router.state.currentMatches]
2616
2625
  }, /*#__PURE__*/React__namespace.createElement(Outlet, null))));
2617
2626
  }
2618
2627
  function useRouter() {
@@ -2638,7 +2647,7 @@
2638
2647
  return router.useRoute(routeId);
2639
2648
  }
2640
2649
  function useSearch(_routeId) {
2641
- return useRouter().state.location.search;
2650
+ return useRouter().state.currentLocation.search;
2642
2651
  }
2643
2652
  function linkProps(props) {
2644
2653
  const router = useRouter();
@@ -2712,10 +2721,10 @@
2712
2721
  const errorComponent = (_props$errorComponent = props.errorComponent) != null ? _props$errorComponent : DefaultErrorBoundary;
2713
2722
  React__namespace.useEffect(() => {
2714
2723
  if (activeErrorState) {
2715
- let prevKey = router.state.location.key;
2724
+ let prevKey = router.state.currentLocation.key;
2716
2725
  return router.subscribe(() => {
2717
- if (router.state.location.key !== prevKey) {
2718
- prevKey = router.state.location.key;
2726
+ if (router.state.currentLocation.key !== prevKey) {
2727
+ prevKey = router.state.currentLocation.key;
2719
2728
  setActiveErrorState({});
2720
2729
  }
2721
2730
  });
@@ -2769,11 +2778,11 @@
2769
2778
  unblock();
2770
2779
  transition.retry();
2771
2780
  } else {
2772
- router.state.location.pathname = window.location.pathname;
2781
+ router.state.currentLocation.pathname = window.location.pathname;
2773
2782
  }
2774
2783
  });
2775
2784
  return unblock;
2776
- }, [when, location, message]);
2785
+ }, [when, message]);
2777
2786
  }
2778
2787
  function Prompt(_ref7) {
2779
2788
  let {