@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.
@@ -1201,6 +1201,7 @@ function toValue(mix) {
1201
1201
  var str = decodeURIComponent(mix);
1202
1202
  if (str === 'false') return false;
1203
1203
  if (str === 'true') return true;
1204
+ if (str.charAt(0) === '0') return str;
1204
1205
  return +str * 0 === 0 ? +str : str;
1205
1206
  }
1206
1207
 
@@ -1769,7 +1770,6 @@ function createRouter(userOptions) {
1769
1770
  matches: [],
1770
1771
  actions: {},
1771
1772
  loaders: {},
1772
- loaderData: {},
1773
1773
  lastUpdated: Date.now(),
1774
1774
  isFetching: false,
1775
1775
  isPreloading: false
@@ -1803,11 +1803,11 @@ function createRouter(userOptions) {
1803
1803
 
1804
1804
  if (next.href !== router.location.href) {
1805
1805
  router.__.commitLocation(next, true);
1806
- } else {
1807
- router.loadLocation();
1808
1806
  }
1809
1807
 
1810
- const unsub = history.listen(event => {
1808
+ router.loadLocation();
1809
+ const unsub = router.history.listen(event => {
1810
+ console.log(event.location);
1811
1811
  router.loadLocation(router.__.parseLocation(event.location, router.location));
1812
1812
  }); // addEventListener does not exist in React Native, but window does
1813
1813
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
@@ -1829,6 +1829,17 @@ function createRouter(userOptions) {
1829
1829
  router.loadLocation();
1830
1830
  },
1831
1831
  update: opts => {
1832
+ const newHistory = (opts == null ? void 0 : opts.history) !== router.history;
1833
+
1834
+ if (!router.location || newHistory) {
1835
+ if (opts != null && opts.history) {
1836
+ router.history = opts.history;
1837
+ }
1838
+
1839
+ router.location = router.__.parseLocation(router.history.location);
1840
+ router.state.location = router.location;
1841
+ }
1842
+
1832
1843
  Object.assign(router.options, opts);
1833
1844
  const {
1834
1845
  basepath,
@@ -1877,7 +1888,7 @@ function createRouter(userOptions) {
1877
1888
 
1878
1889
  router.cancelMatches(); // Match the routes
1879
1890
 
1880
- const matches = router.matchRoutes(location.pathname, {
1891
+ const matches = router.matchRoutes(router.location.pathname, {
1881
1892
  strictParseParams: true
1882
1893
  });
1883
1894
  router.state = _extends({}, router.state, {
@@ -2479,8 +2490,6 @@ function createRouter(userOptions) {
2479
2490
  }
2480
2491
  }
2481
2492
  };
2482
- router.location = router.__.parseLocation(history.location);
2483
- router.state.location = router.location;
2484
2493
  router.update(userOptions); // Allow frameworks to hook into the router creation
2485
2494
 
2486
2495
  router.options.createRouter == null ? void 0 : router.options.createRouter(router);