@tanstack/react-router 0.0.1-beta.3 → 0.0.1-beta.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.
@@ -1170,6 +1170,7 @@ function toValue(mix) {
1170
1170
  var str = decodeURIComponent(mix);
1171
1171
  if (str === 'false') return false;
1172
1172
  if (str === 'true') return true;
1173
+ if (str.charAt(0) === '0') return str;
1173
1174
  return +str * 0 === 0 ? +str : str;
1174
1175
  }
1175
1176
 
@@ -1738,7 +1739,6 @@ function createRouter(userOptions) {
1738
1739
  matches: [],
1739
1740
  actions: {},
1740
1741
  loaders: {},
1741
- loaderData: {},
1742
1742
  lastUpdated: Date.now(),
1743
1743
  isFetching: false,
1744
1744
  isPreloading: false
@@ -1772,11 +1772,11 @@ function createRouter(userOptions) {
1772
1772
 
1773
1773
  if (next.href !== router.location.href) {
1774
1774
  router.__.commitLocation(next, true);
1775
- } else {
1776
- router.loadLocation();
1777
1775
  }
1778
1776
 
1779
- const unsub = history.listen(event => {
1777
+ router.loadLocation();
1778
+ const unsub = router.history.listen(event => {
1779
+ console.log(event.location);
1780
1780
  router.loadLocation(router.__.parseLocation(event.location, router.location));
1781
1781
  }); // addEventListener does not exist in React Native, but window does
1782
1782
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
@@ -1798,6 +1798,17 @@ function createRouter(userOptions) {
1798
1798
  router.loadLocation();
1799
1799
  },
1800
1800
  update: opts => {
1801
+ const newHistory = (opts == null ? void 0 : opts.history) !== router.history;
1802
+
1803
+ if (!router.location || newHistory) {
1804
+ if (opts != null && opts.history) {
1805
+ router.history = opts.history;
1806
+ }
1807
+
1808
+ router.location = router.__.parseLocation(router.history.location);
1809
+ router.state.location = router.location;
1810
+ }
1811
+
1801
1812
  Object.assign(router.options, opts);
1802
1813
  const {
1803
1814
  basepath,
@@ -1846,7 +1857,7 @@ function createRouter(userOptions) {
1846
1857
 
1847
1858
  router.cancelMatches(); // Match the routes
1848
1859
 
1849
- const matches = router.matchRoutes(location.pathname, {
1860
+ const matches = router.matchRoutes(router.location.pathname, {
1850
1861
  strictParseParams: true
1851
1862
  });
1852
1863
  router.state = _extends({}, router.state, {
@@ -2448,8 +2459,6 @@ function createRouter(userOptions) {
2448
2459
  }
2449
2460
  }
2450
2461
  };
2451
- router.location = router.__.parseLocation(history.location);
2452
- router.state.location = router.location;
2453
2462
  router.update(userOptions); // Allow frameworks to hook into the router creation
2454
2463
 
2455
2464
  router.options.createRouter == null ? void 0 : router.options.createRouter(router);