@tanstack/router-core 0.0.1-beta.4 → 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.
@@ -1725,7 +1725,6 @@
1725
1725
  matches: [],
1726
1726
  actions: {},
1727
1727
  loaders: {},
1728
- loaderData: {},
1729
1728
  lastUpdated: Date.now(),
1730
1729
  isFetching: false,
1731
1730
  isPreloading: false
@@ -1759,11 +1758,11 @@
1759
1758
 
1760
1759
  if (next.href !== router.location.href) {
1761
1760
  router.__.commitLocation(next, true);
1762
- } else {
1763
- router.loadLocation();
1764
1761
  }
1765
1762
 
1766
- const unsub = history.listen(event => {
1763
+ router.loadLocation();
1764
+ const unsub = router.history.listen(event => {
1765
+ console.log(event.location);
1767
1766
  router.loadLocation(router.__.parseLocation(event.location, router.location));
1768
1767
  }); // addEventListener does not exist in React Native, but window does
1769
1768
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
@@ -1785,6 +1784,17 @@
1785
1784
  router.loadLocation();
1786
1785
  },
1787
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
+
1788
1798
  Object.assign(router.options, opts);
1789
1799
  const {
1790
1800
  basepath,
@@ -1833,7 +1843,7 @@
1833
1843
 
1834
1844
  router.cancelMatches(); // Match the routes
1835
1845
 
1836
- const matches = router.matchRoutes(location.pathname, {
1846
+ const matches = router.matchRoutes(router.location.pathname, {
1837
1847
  strictParseParams: true
1838
1848
  });
1839
1849
  router.state = _extends({}, router.state, {
@@ -2435,8 +2445,6 @@
2435
2445
  }
2436
2446
  }
2437
2447
  };
2438
- router.location = router.__.parseLocation(history.location);
2439
- router.state.location = router.location;
2440
2448
  router.update(userOptions); // Allow frameworks to hook into the router creation
2441
2449
 
2442
2450
  router.options.createRouter == null ? void 0 : router.options.createRouter(router);