@tanstack/react-router 0.0.1-beta.147 → 0.0.1-beta.149

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.
@@ -4024,7 +4024,7 @@ var drawChart = (function (exports) {
4024
4024
  </script>
4025
4025
  <script>
4026
4026
  /*<!--*/
4027
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"c288-151","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"store/build/esm/index.js","uid":"c288-153"},{"name":"react-store/build/esm/index.js","uid":"c288-155"},{"name":"router-core/build/esm/index.js","uid":"c288-161"},{"name":"react-router/src/index.tsx","uid":"c288-163"}]},{"name":"node_modules/.pnpm","children":[{"name":"tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","uid":"c288-157"},{"name":"tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js","uid":"c288-159"}]}]}],"isRoot":true},"nodeParts":{"c288-151":{"renderedLength":429,"gzipLength":238,"brotliLength":0,"mainUid":"c288-150"},"c288-153":{"renderedLength":1843,"gzipLength":644,"brotliLength":0,"mainUid":"c288-152"},"c288-155":{"renderedLength":1006,"gzipLength":479,"brotliLength":0,"mainUid":"c288-154"},"c288-157":{"renderedLength":181,"gzipLength":129,"brotliLength":0,"mainUid":"c288-156"},"c288-159":{"renderedLength":44,"gzipLength":62,"brotliLength":0,"mainUid":"c288-158"},"c288-161":{"renderedLength":55753,"gzipLength":13207,"brotliLength":0,"mainUid":"c288-160"},"c288-163":{"renderedLength":17095,"gzipLength":3814,"brotliLength":0,"mainUid":"c288-162"}},"nodeMetas":{"c288-150":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"c288-151"},"imported":[],"importedBy":[{"uid":"c288-162"}]},"c288-152":{"id":"/packages/store/build/esm/index.js","moduleParts":{"index.production.js":"c288-153"},"imported":[],"importedBy":[{"uid":"c288-154"}]},"c288-154":{"id":"/packages/react-store/build/esm/index.js","moduleParts":{"index.production.js":"c288-155"},"imported":[{"uid":"c288-165"},{"uid":"c288-152"}],"importedBy":[{"uid":"c288-162"},{"uid":"c288-160"}]},"c288-156":{"id":"/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","moduleParts":{"index.production.js":"c288-157"},"imported":[],"importedBy":[{"uid":"c288-162"},{"uid":"c288-160"}]},"c288-158":{"id":"/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js","moduleParts":{"index.production.js":"c288-159"},"imported":[],"importedBy":[{"uid":"c288-162"},{"uid":"c288-160"}]},"c288-160":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"c288-161"},"imported":[{"uid":"c288-156"},{"uid":"c288-158"},{"uid":"c288-154"}],"importedBy":[{"uid":"c288-162"}]},"c288-162":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"c288-163"},"imported":[{"uid":"c288-150"},{"uid":"c288-164"},{"uid":"c288-154"},{"uid":"c288-156"},{"uid":"c288-158"},{"uid":"c288-160"}],"importedBy":[],"isEntry":true},"c288-164":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"c288-162"}],"isExternal":true},"c288-165":{"id":"use-sync-external-store/shim/with-selector","moduleParts":{},"imported":[],"importedBy":[{"uid":"c288-154"}],"isExternal":true}},"env":{"rollup":"2.79.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4027
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"0085-151","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"store/build/esm/index.js","uid":"0085-153"},{"name":"react-store/build/esm/index.js","uid":"0085-155"},{"name":"router-core/build/esm/index.js","uid":"0085-161"},{"name":"react-router/src/index.tsx","uid":"0085-163"}]},{"name":"node_modules/.pnpm","children":[{"name":"tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","uid":"0085-157"},{"name":"tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js","uid":"0085-159"}]}]}],"isRoot":true},"nodeParts":{"0085-151":{"renderedLength":429,"gzipLength":238,"brotliLength":0,"mainUid":"0085-150"},"0085-153":{"renderedLength":1843,"gzipLength":644,"brotliLength":0,"mainUid":"0085-152"},"0085-155":{"renderedLength":1006,"gzipLength":479,"brotliLength":0,"mainUid":"0085-154"},"0085-157":{"renderedLength":181,"gzipLength":129,"brotliLength":0,"mainUid":"0085-156"},"0085-159":{"renderedLength":44,"gzipLength":62,"brotliLength":0,"mainUid":"0085-158"},"0085-161":{"renderedLength":55969,"gzipLength":13275,"brotliLength":0,"mainUid":"0085-160"},"0085-163":{"renderedLength":17095,"gzipLength":3814,"brotliLength":0,"mainUid":"0085-162"}},"nodeMetas":{"0085-150":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"0085-151"},"imported":[],"importedBy":[{"uid":"0085-162"}]},"0085-152":{"id":"/packages/store/build/esm/index.js","moduleParts":{"index.production.js":"0085-153"},"imported":[],"importedBy":[{"uid":"0085-154"}]},"0085-154":{"id":"/packages/react-store/build/esm/index.js","moduleParts":{"index.production.js":"0085-155"},"imported":[{"uid":"0085-165"},{"uid":"0085-152"}],"importedBy":[{"uid":"0085-162"},{"uid":"0085-160"}]},"0085-156":{"id":"/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","moduleParts":{"index.production.js":"0085-157"},"imported":[],"importedBy":[{"uid":"0085-162"},{"uid":"0085-160"}]},"0085-158":{"id":"/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js","moduleParts":{"index.production.js":"0085-159"},"imported":[],"importedBy":[{"uid":"0085-162"},{"uid":"0085-160"}]},"0085-160":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"0085-161"},"imported":[{"uid":"0085-156"},{"uid":"0085-158"},{"uid":"0085-154"}],"importedBy":[{"uid":"0085-162"}]},"0085-162":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"0085-163"},"imported":[{"uid":"0085-150"},{"uid":"0085-164"},{"uid":"0085-154"},{"uid":"0085-156"},{"uid":"0085-158"},{"uid":"0085-160"}],"importedBy":[],"isEntry":true},"0085-164":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"0085-162"}],"isExternal":true},"0085-165":{"id":"use-sync-external-store/shim/with-selector","moduleParts":{},"imported":[],"importedBy":[{"uid":"0085-154"}],"isExternal":true}},"env":{"rollup":"2.79.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4028
4028
 
4029
4029
  const run = () => {
4030
4030
  const width = window.innerWidth;
@@ -7,7 +7,7 @@
7
7
  "name": "index.production.js",
8
8
  "children": [
9
9
  {
10
- "uid": "c288-167",
10
+ "uid": "0085-167",
11
11
  "name": "\u0000rollupPluginBabelHelpers.js"
12
12
  },
13
13
  {
@@ -15,19 +15,19 @@
15
15
  "children": [
16
16
  {
17
17
  "name": "store/build/esm/index.js",
18
- "uid": "c288-169"
18
+ "uid": "0085-169"
19
19
  },
20
20
  {
21
21
  "name": "react-store/build/esm/index.js",
22
- "uid": "c288-171"
22
+ "uid": "0085-171"
23
23
  },
24
24
  {
25
25
  "name": "router-core/build/esm/index.js",
26
- "uid": "c288-177"
26
+ "uid": "0085-177"
27
27
  },
28
28
  {
29
29
  "name": "react-router/src/index.tsx",
30
- "uid": "c288-179"
30
+ "uid": "0085-179"
31
31
  }
32
32
  ]
33
33
  },
@@ -36,11 +36,11 @@
36
36
  "children": [
37
37
  {
38
38
  "name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
39
- "uid": "c288-173"
39
+ "uid": "0085-173"
40
40
  },
41
41
  {
42
42
  "name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
43
- "uid": "c288-175"
43
+ "uid": "0085-175"
44
44
  }
45
45
  ]
46
46
  }
@@ -50,194 +50,194 @@
50
50
  "isRoot": true
51
51
  },
52
52
  "nodeParts": {
53
- "c288-167": {
53
+ "0085-167": {
54
54
  "renderedLength": 429,
55
55
  "gzipLength": 238,
56
56
  "brotliLength": 0,
57
- "mainUid": "c288-166"
57
+ "mainUid": "0085-166"
58
58
  },
59
- "c288-169": {
59
+ "0085-169": {
60
60
  "renderedLength": 1843,
61
61
  "gzipLength": 644,
62
62
  "brotliLength": 0,
63
- "mainUid": "c288-168"
63
+ "mainUid": "0085-168"
64
64
  },
65
- "c288-171": {
65
+ "0085-171": {
66
66
  "renderedLength": 1006,
67
67
  "gzipLength": 479,
68
68
  "brotliLength": 0,
69
- "mainUid": "c288-170"
69
+ "mainUid": "0085-170"
70
70
  },
71
- "c288-173": {
71
+ "0085-173": {
72
72
  "renderedLength": 181,
73
73
  "gzipLength": 129,
74
74
  "brotliLength": 0,
75
- "mainUid": "c288-172"
75
+ "mainUid": "0085-172"
76
76
  },
77
- "c288-175": {
77
+ "0085-175": {
78
78
  "renderedLength": 44,
79
79
  "gzipLength": 62,
80
80
  "brotliLength": 0,
81
- "mainUid": "c288-174"
81
+ "mainUid": "0085-174"
82
82
  },
83
- "c288-177": {
84
- "renderedLength": 55753,
85
- "gzipLength": 13207,
83
+ "0085-177": {
84
+ "renderedLength": 55969,
85
+ "gzipLength": 13275,
86
86
  "brotliLength": 0,
87
- "mainUid": "c288-176"
87
+ "mainUid": "0085-176"
88
88
  },
89
- "c288-179": {
89
+ "0085-179": {
90
90
  "renderedLength": 17095,
91
91
  "gzipLength": 3814,
92
92
  "brotliLength": 0,
93
- "mainUid": "c288-178"
93
+ "mainUid": "0085-178"
94
94
  }
95
95
  },
96
96
  "nodeMetas": {
97
- "c288-166": {
97
+ "0085-166": {
98
98
  "id": "\u0000rollupPluginBabelHelpers.js",
99
99
  "moduleParts": {
100
- "index.production.js": "c288-167"
100
+ "index.production.js": "0085-167"
101
101
  },
102
102
  "imported": [],
103
103
  "importedBy": [
104
104
  {
105
- "uid": "c288-178"
105
+ "uid": "0085-178"
106
106
  }
107
107
  ]
108
108
  },
109
- "c288-168": {
109
+ "0085-168": {
110
110
  "id": "/packages/store/build/esm/index.js",
111
111
  "moduleParts": {
112
- "index.production.js": "c288-169"
112
+ "index.production.js": "0085-169"
113
113
  },
114
114
  "imported": [],
115
115
  "importedBy": [
116
116
  {
117
- "uid": "c288-170"
117
+ "uid": "0085-170"
118
118
  }
119
119
  ]
120
120
  },
121
- "c288-170": {
121
+ "0085-170": {
122
122
  "id": "/packages/react-store/build/esm/index.js",
123
123
  "moduleParts": {
124
- "index.production.js": "c288-171"
124
+ "index.production.js": "0085-171"
125
125
  },
126
126
  "imported": [
127
127
  {
128
- "uid": "c288-181"
128
+ "uid": "0085-181"
129
129
  },
130
130
  {
131
- "uid": "c288-168"
131
+ "uid": "0085-168"
132
132
  }
133
133
  ],
134
134
  "importedBy": [
135
135
  {
136
- "uid": "c288-178"
136
+ "uid": "0085-178"
137
137
  },
138
138
  {
139
- "uid": "c288-176"
139
+ "uid": "0085-176"
140
140
  }
141
141
  ]
142
142
  },
143
- "c288-172": {
143
+ "0085-172": {
144
144
  "id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
145
145
  "moduleParts": {
146
- "index.production.js": "c288-173"
146
+ "index.production.js": "0085-173"
147
147
  },
148
148
  "imported": [],
149
149
  "importedBy": [
150
150
  {
151
- "uid": "c288-178"
151
+ "uid": "0085-178"
152
152
  },
153
153
  {
154
- "uid": "c288-176"
154
+ "uid": "0085-176"
155
155
  }
156
156
  ]
157
157
  },
158
- "c288-174": {
158
+ "0085-174": {
159
159
  "id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
160
160
  "moduleParts": {
161
- "index.production.js": "c288-175"
161
+ "index.production.js": "0085-175"
162
162
  },
163
163
  "imported": [],
164
164
  "importedBy": [
165
165
  {
166
- "uid": "c288-178"
166
+ "uid": "0085-178"
167
167
  },
168
168
  {
169
- "uid": "c288-176"
169
+ "uid": "0085-176"
170
170
  }
171
171
  ]
172
172
  },
173
- "c288-176": {
173
+ "0085-176": {
174
174
  "id": "/packages/router-core/build/esm/index.js",
175
175
  "moduleParts": {
176
- "index.production.js": "c288-177"
176
+ "index.production.js": "0085-177"
177
177
  },
178
178
  "imported": [
179
179
  {
180
- "uid": "c288-172"
180
+ "uid": "0085-172"
181
181
  },
182
182
  {
183
- "uid": "c288-174"
183
+ "uid": "0085-174"
184
184
  },
185
185
  {
186
- "uid": "c288-170"
186
+ "uid": "0085-170"
187
187
  }
188
188
  ],
189
189
  "importedBy": [
190
190
  {
191
- "uid": "c288-178"
191
+ "uid": "0085-178"
192
192
  }
193
193
  ]
194
194
  },
195
- "c288-178": {
195
+ "0085-178": {
196
196
  "id": "/packages/react-router/src/index.tsx",
197
197
  "moduleParts": {
198
- "index.production.js": "c288-179"
198
+ "index.production.js": "0085-179"
199
199
  },
200
200
  "imported": [
201
201
  {
202
- "uid": "c288-166"
202
+ "uid": "0085-166"
203
203
  },
204
204
  {
205
- "uid": "c288-180"
205
+ "uid": "0085-180"
206
206
  },
207
207
  {
208
- "uid": "c288-170"
208
+ "uid": "0085-170"
209
209
  },
210
210
  {
211
- "uid": "c288-172"
211
+ "uid": "0085-172"
212
212
  },
213
213
  {
214
- "uid": "c288-174"
214
+ "uid": "0085-174"
215
215
  },
216
216
  {
217
- "uid": "c288-176"
217
+ "uid": "0085-176"
218
218
  }
219
219
  ],
220
220
  "importedBy": [],
221
221
  "isEntry": true
222
222
  },
223
- "c288-180": {
223
+ "0085-180": {
224
224
  "id": "react",
225
225
  "moduleParts": {},
226
226
  "imported": [],
227
227
  "importedBy": [
228
228
  {
229
- "uid": "c288-178"
229
+ "uid": "0085-178"
230
230
  }
231
231
  ],
232
232
  "isExternal": true
233
233
  },
234
- "c288-181": {
234
+ "0085-181": {
235
235
  "id": "use-sync-external-store/shim/with-selector",
236
236
  "moduleParts": {},
237
237
  "imported": [],
238
238
  "importedBy": [
239
239
  {
240
- "uid": "c288-170"
240
+ "uid": "0085-170"
241
241
  }
242
242
  ],
243
243
  "isExternal": true
@@ -1106,7 +1106,7 @@
1106
1106
  matchRoutes = (pathname, locationSearch, opts) => {
1107
1107
  let routeParams = {};
1108
1108
  let foundRoute = this.flatRoutes.find(route => {
1109
- const matchedParams = matchPathname(this.basepath, pathname, {
1109
+ const matchedParams = matchPathname(this.basepath, trimPathRight(pathname), {
1110
1110
  to: route.fullPath,
1111
1111
  caseSensitive: route.options.caseSensitive ?? this.options.caseSensitive
1112
1112
  });
@@ -1262,26 +1262,28 @@
1262
1262
  };
1263
1263
  loadMatches = async (resolvedMatches, opts) => {
1264
1264
  this.cleanMatches();
1265
+ if (!opts?.preload) {
1266
+ resolvedMatches.forEach(match => {
1267
+ // Update each match with its latest url data
1268
+ this.setRouteMatch(match.id, s => ({
1269
+ ...s,
1270
+ routeSearch: match.routeSearch,
1271
+ search: match.search,
1272
+ routeContext: match.routeContext,
1273
+ context: match.context,
1274
+ error: match.error,
1275
+ paramsError: match.paramsError,
1276
+ searchError: match.searchError,
1277
+ params: match.params
1278
+ }));
1279
+ });
1280
+ }
1265
1281
  let firstBadMatchIndex;
1266
1282
 
1267
1283
  // Check each match middleware to see if the route can be accessed
1268
1284
  try {
1269
- await Promise.all(resolvedMatches.map(async (match, index) => {
1285
+ for (const [index, match] of resolvedMatches.entries()) {
1270
1286
  const route = this.getRoute(match.routeId);
1271
- if (!opts?.preload) {
1272
- // Update each match with its latest url data
1273
- this.setRouteMatch(match.id, s => ({
1274
- ...s,
1275
- routeSearch: match.routeSearch,
1276
- search: match.search,
1277
- routeContext: match.routeContext,
1278
- context: match.context,
1279
- error: match.error,
1280
- paramsError: match.paramsError,
1281
- searchError: match.searchError,
1282
- params: match.params
1283
- }));
1284
- }
1285
1287
  const handleError = (err, handler) => {
1286
1288
  firstBadMatchIndex = firstBadMatchIndex ?? index;
1287
1289
  handler = handler || route.options.onError;
@@ -1309,6 +1311,7 @@
1309
1311
  if (match.searchError) {
1310
1312
  handleError(match.searchError, route.options.onValidateSearchError);
1311
1313
  }
1314
+ let didError = false;
1312
1315
  try {
1313
1316
  await route.options.beforeLoad?.({
1314
1317
  ...match,
@@ -1316,8 +1319,14 @@
1316
1319
  });
1317
1320
  } catch (err) {
1318
1321
  handleError(err, route.options.onBeforeLoadError);
1322
+ didError = true;
1319
1323
  }
1320
- }));
1324
+
1325
+ // If we errored, do not run the next matches' middleware
1326
+ if (didError) {
1327
+ break;
1328
+ }
1329
+ }
1321
1330
  } catch (err) {
1322
1331
  if (!opts?.preload) {
1323
1332
  this.navigate(err);