@tanstack/router-core 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.
@@ -145,7 +145,6 @@ interface RouterState {
145
145
  location: Location;
146
146
  matches: RouteMatch[];
147
147
  lastUpdated: number;
148
- loaderData: unknown;
149
148
  currentAction?: ActionState;
150
149
  latestAction?: ActionState;
151
150
  actions: Record<string, Action>;
@@ -1156,6 +1156,7 @@
1156
1156
  var str = decodeURIComponent(mix);
1157
1157
  if (str === 'false') return false;
1158
1158
  if (str === 'true') return true;
1159
+ if (str.charAt(0) === '0') return str;
1159
1160
  return +str * 0 === 0 ? +str : str;
1160
1161
  }
1161
1162
 
@@ -1724,7 +1725,6 @@
1724
1725
  matches: [],
1725
1726
  actions: {},
1726
1727
  loaders: {},
1727
- loaderData: {},
1728
1728
  lastUpdated: Date.now(),
1729
1729
  isFetching: false,
1730
1730
  isPreloading: false
@@ -1758,11 +1758,11 @@
1758
1758
 
1759
1759
  if (next.href !== router.location.href) {
1760
1760
  router.__.commitLocation(next, true);
1761
- } else {
1762
- router.loadLocation();
1763
1761
  }
1764
1762
 
1765
- const unsub = history.listen(event => {
1763
+ router.loadLocation();
1764
+ const unsub = router.history.listen(event => {
1765
+ console.log(event.location);
1766
1766
  router.loadLocation(router.__.parseLocation(event.location, router.location));
1767
1767
  }); // addEventListener does not exist in React Native, but window does
1768
1768
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
@@ -1784,6 +1784,17 @@
1784
1784
  router.loadLocation();
1785
1785
  },
1786
1786
  update: opts => {
1787
+ const newHistory = (opts == null ? void 0 : opts.history) !== router.history;
1788
+
1789
+ if (!router.location || newHistory) {
1790
+ if (opts != null && opts.history) {
1791
+ router.history = opts.history;
1792
+ }
1793
+
1794
+ router.location = router.__.parseLocation(router.history.location);
1795
+ router.state.location = router.location;
1796
+ }
1797
+
1787
1798
  Object.assign(router.options, opts);
1788
1799
  const {
1789
1800
  basepath,
@@ -1832,7 +1843,7 @@
1832
1843
 
1833
1844
  router.cancelMatches(); // Match the routes
1834
1845
 
1835
- const matches = router.matchRoutes(location.pathname, {
1846
+ const matches = router.matchRoutes(router.location.pathname, {
1836
1847
  strictParseParams: true
1837
1848
  });
1838
1849
  router.state = _extends({}, router.state, {
@@ -2434,8 +2445,6 @@
2434
2445
  }
2435
2446
  }
2436
2447
  };
2437
- router.location = router.__.parseLocation(history.location);
2438
- router.state.location = router.location;
2439
2448
  router.update(userOptions); // Allow frameworks to hook into the router creation
2440
2449
 
2441
2450
  router.options.createRouter == null ? void 0 : router.options.createRouter(router);