@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.
@@ -4014,7 +4014,7 @@ var drawChart = (function (exports) {
4014
4014
  </script>
4015
4015
  <script>
4016
4016
  /*<!--*/
4017
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"9010-59","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"9010-61"},{"name":"react-router/src/index.tsx","uid":"9010-63"}]}]}],"isRoot":true},"nodeParts":{"9010-59":{"renderedLength":798,"gzipLength":366,"brotliLength":0,"mainUid":"9010-58"},"9010-61":{"renderedLength":74801,"gzipLength":15577,"brotliLength":0,"mainUid":"9010-60"},"9010-63":{"renderedLength":12726,"gzipLength":3316,"brotliLength":0,"mainUid":"9010-62"}},"nodeMetas":{"9010-58":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"9010-59"},"imported":[],"importedBy":[{"uid":"9010-62"}]},"9010-60":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"9010-61"},"imported":[],"importedBy":[{"uid":"9010-62"}]},"9010-62":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"9010-63"},"imported":[{"uid":"9010-58"},{"uid":"9010-64"},{"uid":"9010-65"},{"uid":"9010-60"}],"importedBy":[],"isEntry":true},"9010-64":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"9010-62"}],"isExternal":true},"9010-65":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"9010-62"}],"isExternal":true}},"env":{"rollup":"2.77.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4017
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"bb70-59","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"bb70-61"},{"name":"react-router/src/index.tsx","uid":"bb70-63"}]}]}],"isRoot":true},"nodeParts":{"bb70-59":{"renderedLength":798,"gzipLength":366,"brotliLength":0,"mainUid":"bb70-58"},"bb70-61":{"renderedLength":75119,"gzipLength":15621,"brotliLength":0,"mainUid":"bb70-60"},"bb70-63":{"renderedLength":12726,"gzipLength":3316,"brotliLength":0,"mainUid":"bb70-62"}},"nodeMetas":{"bb70-58":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"bb70-59"},"imported":[],"importedBy":[{"uid":"bb70-62"}]},"bb70-60":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"bb70-61"},"imported":[],"importedBy":[{"uid":"bb70-62"}]},"bb70-62":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"bb70-63"},"imported":[{"uid":"bb70-58"},{"uid":"bb70-64"},{"uid":"bb70-65"},{"uid":"bb70-60"}],"importedBy":[],"isEntry":true},"bb70-64":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"bb70-62"}],"isExternal":true},"bb70-65":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"bb70-62"}],"isExternal":true}},"env":{"rollup":"2.77.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4018
4018
 
4019
4019
  const run = () => {
4020
4020
  const width = window.innerWidth;
@@ -7,7 +7,7 @@
7
7
  "name": "index.production.js",
8
8
  "children": [
9
9
  {
10
- "uid": "9010-67",
10
+ "uid": "bb70-67",
11
11
  "name": "\u0000rollupPluginBabelHelpers.js"
12
12
  },
13
13
  {
@@ -15,11 +15,11 @@
15
15
  "children": [
16
16
  {
17
17
  "name": "router-core/build/esm/index.js",
18
- "uid": "9010-69"
18
+ "uid": "bb70-69"
19
19
  },
20
20
  {
21
21
  "name": "react-router/src/index.tsx",
22
- "uid": "9010-71"
22
+ "uid": "bb70-71"
23
23
  }
24
24
  ]
25
25
  }
@@ -29,90 +29,90 @@
29
29
  "isRoot": true
30
30
  },
31
31
  "nodeParts": {
32
- "9010-67": {
32
+ "bb70-67": {
33
33
  "renderedLength": 798,
34
34
  "gzipLength": 366,
35
35
  "brotliLength": 0,
36
- "mainUid": "9010-66"
36
+ "mainUid": "bb70-66"
37
37
  },
38
- "9010-69": {
39
- "renderedLength": 74801,
40
- "gzipLength": 15577,
38
+ "bb70-69": {
39
+ "renderedLength": 75119,
40
+ "gzipLength": 15621,
41
41
  "brotliLength": 0,
42
- "mainUid": "9010-68"
42
+ "mainUid": "bb70-68"
43
43
  },
44
- "9010-71": {
44
+ "bb70-71": {
45
45
  "renderedLength": 12726,
46
46
  "gzipLength": 3316,
47
47
  "brotliLength": 0,
48
- "mainUid": "9010-70"
48
+ "mainUid": "bb70-70"
49
49
  }
50
50
  },
51
51
  "nodeMetas": {
52
- "9010-66": {
52
+ "bb70-66": {
53
53
  "id": "\u0000rollupPluginBabelHelpers.js",
54
54
  "moduleParts": {
55
- "index.production.js": "9010-67"
55
+ "index.production.js": "bb70-67"
56
56
  },
57
57
  "imported": [],
58
58
  "importedBy": [
59
59
  {
60
- "uid": "9010-70"
60
+ "uid": "bb70-70"
61
61
  }
62
62
  ]
63
63
  },
64
- "9010-68": {
64
+ "bb70-68": {
65
65
  "id": "/packages/router-core/build/esm/index.js",
66
66
  "moduleParts": {
67
- "index.production.js": "9010-69"
67
+ "index.production.js": "bb70-69"
68
68
  },
69
69
  "imported": [],
70
70
  "importedBy": [
71
71
  {
72
- "uid": "9010-70"
72
+ "uid": "bb70-70"
73
73
  }
74
74
  ]
75
75
  },
76
- "9010-70": {
76
+ "bb70-70": {
77
77
  "id": "/packages/react-router/src/index.tsx",
78
78
  "moduleParts": {
79
- "index.production.js": "9010-71"
79
+ "index.production.js": "bb70-71"
80
80
  },
81
81
  "imported": [
82
82
  {
83
- "uid": "9010-66"
83
+ "uid": "bb70-66"
84
84
  },
85
85
  {
86
- "uid": "9010-72"
86
+ "uid": "bb70-72"
87
87
  },
88
88
  {
89
- "uid": "9010-73"
89
+ "uid": "bb70-73"
90
90
  },
91
91
  {
92
- "uid": "9010-68"
92
+ "uid": "bb70-68"
93
93
  }
94
94
  ],
95
95
  "importedBy": [],
96
96
  "isEntry": true
97
97
  },
98
- "9010-72": {
98
+ "bb70-72": {
99
99
  "id": "react",
100
100
  "moduleParts": {},
101
101
  "imported": [],
102
102
  "importedBy": [
103
103
  {
104
- "uid": "9010-70"
104
+ "uid": "bb70-70"
105
105
  }
106
106
  ],
107
107
  "isExternal": true
108
108
  },
109
- "9010-73": {
109
+ "bb70-73": {
110
110
  "id": "use-sync-external-store/shim",
111
111
  "moduleParts": {},
112
112
  "imported": [],
113
113
  "importedBy": [
114
114
  {
115
- "uid": "9010-70"
115
+ "uid": "bb70-70"
116
116
  }
117
117
  ],
118
118
  "isExternal": true
@@ -1217,6 +1217,7 @@
1217
1217
  var str = decodeURIComponent(mix);
1218
1218
  if (str === 'false') return false;
1219
1219
  if (str === 'true') return true;
1220
+ if (str.charAt(0) === '0') return str;
1220
1221
  return +str * 0 === 0 ? +str : str;
1221
1222
  }
1222
1223
 
@@ -1785,7 +1786,6 @@
1785
1786
  matches: [],
1786
1787
  actions: {},
1787
1788
  loaders: {},
1788
- loaderData: {},
1789
1789
  lastUpdated: Date.now(),
1790
1790
  isFetching: false,
1791
1791
  isPreloading: false
@@ -1819,11 +1819,11 @@
1819
1819
 
1820
1820
  if (next.href !== router.location.href) {
1821
1821
  router.__.commitLocation(next, true);
1822
- } else {
1823
- router.loadLocation();
1824
1822
  }
1825
1823
 
1826
- const unsub = history.listen(event => {
1824
+ router.loadLocation();
1825
+ const unsub = router.history.listen(event => {
1826
+ console.log(event.location);
1827
1827
  router.loadLocation(router.__.parseLocation(event.location, router.location));
1828
1828
  }); // addEventListener does not exist in React Native, but window does
1829
1829
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
@@ -1845,6 +1845,17 @@
1845
1845
  router.loadLocation();
1846
1846
  },
1847
1847
  update: opts => {
1848
+ const newHistory = (opts == null ? void 0 : opts.history) !== router.history;
1849
+
1850
+ if (!router.location || newHistory) {
1851
+ if (opts != null && opts.history) {
1852
+ router.history = opts.history;
1853
+ }
1854
+
1855
+ router.location = router.__.parseLocation(router.history.location);
1856
+ router.state.location = router.location;
1857
+ }
1858
+
1848
1859
  Object.assign(router.options, opts);
1849
1860
  const {
1850
1861
  basepath,
@@ -1893,7 +1904,7 @@
1893
1904
 
1894
1905
  router.cancelMatches(); // Match the routes
1895
1906
 
1896
- const matches = router.matchRoutes(location.pathname, {
1907
+ const matches = router.matchRoutes(router.location.pathname, {
1897
1908
  strictParseParams: true
1898
1909
  });
1899
1910
  router.state = _extends({}, router.state, {
@@ -2495,8 +2506,6 @@
2495
2506
  }
2496
2507
  }
2497
2508
  };
2498
- router.location = router.__.parseLocation(history.location);
2499
- router.state.location = router.location;
2500
2509
  router.update(userOptions); // Allow frameworks to hook into the router creation
2501
2510
 
2502
2511
  router.options.createRouter == null ? void 0 : router.options.createRouter(router);