@tanstack/react-router 0.0.1-beta.81 → 0.0.1-beta.82

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":"298b-97","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"node_modules/.pnpm","children":[{"name":"tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","uid":"298b-99"},{"name":"tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js","uid":"298b-101"}]},{"name":"packages","children":[{"name":"store/build/esm/index.js","uid":"298b-103"},{"name":"router/build/esm/index.js","uid":"298b-105"},{"name":"react-store/build/esm/index.js","uid":"298b-107"},{"name":"react-router/src/index.tsx","uid":"298b-109"}]}]}],"isRoot":true},"nodeParts":{"298b-97":{"renderedLength":429,"gzipLength":238,"brotliLength":0,"mainUid":"298b-96"},"298b-99":{"renderedLength":181,"gzipLength":129,"brotliLength":0,"mainUid":"298b-98"},"298b-101":{"renderedLength":44,"gzipLength":62,"brotliLength":0,"mainUid":"298b-100"},"298b-103":{"renderedLength":2382,"gzipLength":809,"brotliLength":0,"mainUid":"298b-102"},"298b-105":{"renderedLength":50465,"gzipLength":11828,"brotliLength":0,"mainUid":"298b-104"},"298b-107":{"renderedLength":477,"gzipLength":284,"brotliLength":0,"mainUid":"298b-106"},"298b-109":{"renderedLength":12276,"gzipLength":3105,"brotliLength":0,"mainUid":"298b-108"}},"nodeMetas":{"298b-96":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"298b-97"},"imported":[],"importedBy":[{"uid":"298b-108"}]},"298b-98":{"id":"/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","moduleParts":{"index.production.js":"298b-99"},"imported":[],"importedBy":[{"uid":"298b-104"}]},"298b-100":{"id":"/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js","moduleParts":{"index.production.js":"298b-101"},"imported":[],"importedBy":[{"uid":"298b-104"}]},"298b-102":{"id":"/packages/store/build/esm/index.js","moduleParts":{"index.production.js":"298b-103"},"imported":[],"importedBy":[{"uid":"298b-104"},{"uid":"298b-106"}]},"298b-104":{"id":"/packages/router/build/esm/index.js","moduleParts":{"index.production.js":"298b-105"},"imported":[{"uid":"298b-98"},{"uid":"298b-100"},{"uid":"298b-102"}],"importedBy":[{"uid":"298b-108"}]},"298b-106":{"id":"/packages/react-store/build/esm/index.js","moduleParts":{"index.production.js":"298b-107"},"imported":[{"uid":"298b-102"},{"uid":"298b-111"}],"importedBy":[{"uid":"298b-108"}]},"298b-108":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"298b-109"},"imported":[{"uid":"298b-96"},{"uid":"298b-110"},{"uid":"298b-104"},{"uid":"298b-106"}],"importedBy":[],"isEntry":true},"298b-110":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"298b-108"}],"isExternal":true},"298b-111":{"id":"use-sync-external-store/shim/with-selector","moduleParts":{},"imported":[],"importedBy":[{"uid":"298b-106"}],"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":"ea8f-97","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"node_modules/.pnpm","children":[{"name":"tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","uid":"ea8f-99"},{"name":"tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js","uid":"ea8f-101"}]},{"name":"packages","children":[{"name":"store/build/esm/index.js","uid":"ea8f-103"},{"name":"router/build/esm/index.js","uid":"ea8f-105"},{"name":"react-store/build/esm/index.js","uid":"ea8f-107"},{"name":"react-router/src/index.tsx","uid":"ea8f-109"}]}]}],"isRoot":true},"nodeParts":{"ea8f-97":{"renderedLength":429,"gzipLength":238,"brotliLength":0,"mainUid":"ea8f-96"},"ea8f-99":{"renderedLength":181,"gzipLength":129,"brotliLength":0,"mainUid":"ea8f-98"},"ea8f-101":{"renderedLength":44,"gzipLength":62,"brotliLength":0,"mainUid":"ea8f-100"},"ea8f-103":{"renderedLength":2382,"gzipLength":809,"brotliLength":0,"mainUid":"ea8f-102"},"ea8f-105":{"renderedLength":51237,"gzipLength":11956,"brotliLength":0,"mainUid":"ea8f-104"},"ea8f-107":{"renderedLength":477,"gzipLength":284,"brotliLength":0,"mainUid":"ea8f-106"},"ea8f-109":{"renderedLength":12276,"gzipLength":3105,"brotliLength":0,"mainUid":"ea8f-108"}},"nodeMetas":{"ea8f-96":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"ea8f-97"},"imported":[],"importedBy":[{"uid":"ea8f-108"}]},"ea8f-98":{"id":"/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","moduleParts":{"index.production.js":"ea8f-99"},"imported":[],"importedBy":[{"uid":"ea8f-104"}]},"ea8f-100":{"id":"/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js","moduleParts":{"index.production.js":"ea8f-101"},"imported":[],"importedBy":[{"uid":"ea8f-104"}]},"ea8f-102":{"id":"/packages/store/build/esm/index.js","moduleParts":{"index.production.js":"ea8f-103"},"imported":[],"importedBy":[{"uid":"ea8f-104"},{"uid":"ea8f-106"}]},"ea8f-104":{"id":"/packages/router/build/esm/index.js","moduleParts":{"index.production.js":"ea8f-105"},"imported":[{"uid":"ea8f-98"},{"uid":"ea8f-100"},{"uid":"ea8f-102"}],"importedBy":[{"uid":"ea8f-108"}]},"ea8f-106":{"id":"/packages/react-store/build/esm/index.js","moduleParts":{"index.production.js":"ea8f-107"},"imported":[{"uid":"ea8f-102"},{"uid":"ea8f-111"}],"importedBy":[{"uid":"ea8f-108"}]},"ea8f-108":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"ea8f-109"},"imported":[{"uid":"ea8f-96"},{"uid":"ea8f-110"},{"uid":"ea8f-104"},{"uid":"ea8f-106"}],"importedBy":[],"isEntry":true},"ea8f-110":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea8f-108"}],"isExternal":true},"ea8f-111":{"id":"use-sync-external-store/shim/with-selector","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea8f-106"}],"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": "298b-113",
10
+ "uid": "ea8f-113",
11
11
  "name": "\u0000rollupPluginBabelHelpers.js"
12
12
  },
13
13
  {
@@ -15,11 +15,11 @@
15
15
  "children": [
16
16
  {
17
17
  "name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
18
- "uid": "298b-115"
18
+ "uid": "ea8f-115"
19
19
  },
20
20
  {
21
21
  "name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
22
- "uid": "298b-117"
22
+ "uid": "ea8f-117"
23
23
  }
24
24
  ]
25
25
  },
@@ -28,19 +28,19 @@
28
28
  "children": [
29
29
  {
30
30
  "name": "store/build/esm/index.js",
31
- "uid": "298b-119"
31
+ "uid": "ea8f-119"
32
32
  },
33
33
  {
34
34
  "name": "router/build/esm/index.js",
35
- "uid": "298b-121"
35
+ "uid": "ea8f-121"
36
36
  },
37
37
  {
38
38
  "name": "react-store/build/esm/index.js",
39
- "uid": "298b-123"
39
+ "uid": "ea8f-123"
40
40
  },
41
41
  {
42
42
  "name": "react-router/src/index.tsx",
43
- "uid": "298b-125"
43
+ "uid": "ea8f-125"
44
44
  }
45
45
  ]
46
46
  }
@@ -50,182 +50,182 @@
50
50
  "isRoot": true
51
51
  },
52
52
  "nodeParts": {
53
- "298b-113": {
53
+ "ea8f-113": {
54
54
  "renderedLength": 429,
55
55
  "gzipLength": 238,
56
56
  "brotliLength": 0,
57
- "mainUid": "298b-112"
57
+ "mainUid": "ea8f-112"
58
58
  },
59
- "298b-115": {
59
+ "ea8f-115": {
60
60
  "renderedLength": 181,
61
61
  "gzipLength": 129,
62
62
  "brotliLength": 0,
63
- "mainUid": "298b-114"
63
+ "mainUid": "ea8f-114"
64
64
  },
65
- "298b-117": {
65
+ "ea8f-117": {
66
66
  "renderedLength": 44,
67
67
  "gzipLength": 62,
68
68
  "brotliLength": 0,
69
- "mainUid": "298b-116"
69
+ "mainUid": "ea8f-116"
70
70
  },
71
- "298b-119": {
71
+ "ea8f-119": {
72
72
  "renderedLength": 2382,
73
73
  "gzipLength": 809,
74
74
  "brotliLength": 0,
75
- "mainUid": "298b-118"
75
+ "mainUid": "ea8f-118"
76
76
  },
77
- "298b-121": {
78
- "renderedLength": 50465,
79
- "gzipLength": 11828,
77
+ "ea8f-121": {
78
+ "renderedLength": 51237,
79
+ "gzipLength": 11956,
80
80
  "brotliLength": 0,
81
- "mainUid": "298b-120"
81
+ "mainUid": "ea8f-120"
82
82
  },
83
- "298b-123": {
83
+ "ea8f-123": {
84
84
  "renderedLength": 477,
85
85
  "gzipLength": 284,
86
86
  "brotliLength": 0,
87
- "mainUid": "298b-122"
87
+ "mainUid": "ea8f-122"
88
88
  },
89
- "298b-125": {
89
+ "ea8f-125": {
90
90
  "renderedLength": 12276,
91
91
  "gzipLength": 3105,
92
92
  "brotliLength": 0,
93
- "mainUid": "298b-124"
93
+ "mainUid": "ea8f-124"
94
94
  }
95
95
  },
96
96
  "nodeMetas": {
97
- "298b-112": {
97
+ "ea8f-112": {
98
98
  "id": "\u0000rollupPluginBabelHelpers.js",
99
99
  "moduleParts": {
100
- "index.production.js": "298b-113"
100
+ "index.production.js": "ea8f-113"
101
101
  },
102
102
  "imported": [],
103
103
  "importedBy": [
104
104
  {
105
- "uid": "298b-124"
105
+ "uid": "ea8f-124"
106
106
  }
107
107
  ]
108
108
  },
109
- "298b-114": {
109
+ "ea8f-114": {
110
110
  "id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
111
111
  "moduleParts": {
112
- "index.production.js": "298b-115"
112
+ "index.production.js": "ea8f-115"
113
113
  },
114
114
  "imported": [],
115
115
  "importedBy": [
116
116
  {
117
- "uid": "298b-120"
117
+ "uid": "ea8f-120"
118
118
  }
119
119
  ]
120
120
  },
121
- "298b-116": {
121
+ "ea8f-116": {
122
122
  "id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
123
123
  "moduleParts": {
124
- "index.production.js": "298b-117"
124
+ "index.production.js": "ea8f-117"
125
125
  },
126
126
  "imported": [],
127
127
  "importedBy": [
128
128
  {
129
- "uid": "298b-120"
129
+ "uid": "ea8f-120"
130
130
  }
131
131
  ]
132
132
  },
133
- "298b-118": {
133
+ "ea8f-118": {
134
134
  "id": "/packages/store/build/esm/index.js",
135
135
  "moduleParts": {
136
- "index.production.js": "298b-119"
136
+ "index.production.js": "ea8f-119"
137
137
  },
138
138
  "imported": [],
139
139
  "importedBy": [
140
140
  {
141
- "uid": "298b-120"
141
+ "uid": "ea8f-120"
142
142
  },
143
143
  {
144
- "uid": "298b-122"
144
+ "uid": "ea8f-122"
145
145
  }
146
146
  ]
147
147
  },
148
- "298b-120": {
148
+ "ea8f-120": {
149
149
  "id": "/packages/router/build/esm/index.js",
150
150
  "moduleParts": {
151
- "index.production.js": "298b-121"
151
+ "index.production.js": "ea8f-121"
152
152
  },
153
153
  "imported": [
154
154
  {
155
- "uid": "298b-114"
155
+ "uid": "ea8f-114"
156
156
  },
157
157
  {
158
- "uid": "298b-116"
158
+ "uid": "ea8f-116"
159
159
  },
160
160
  {
161
- "uid": "298b-118"
161
+ "uid": "ea8f-118"
162
162
  }
163
163
  ],
164
164
  "importedBy": [
165
165
  {
166
- "uid": "298b-124"
166
+ "uid": "ea8f-124"
167
167
  }
168
168
  ]
169
169
  },
170
- "298b-122": {
170
+ "ea8f-122": {
171
171
  "id": "/packages/react-store/build/esm/index.js",
172
172
  "moduleParts": {
173
- "index.production.js": "298b-123"
173
+ "index.production.js": "ea8f-123"
174
174
  },
175
175
  "imported": [
176
176
  {
177
- "uid": "298b-118"
177
+ "uid": "ea8f-118"
178
178
  },
179
179
  {
180
- "uid": "298b-127"
180
+ "uid": "ea8f-127"
181
181
  }
182
182
  ],
183
183
  "importedBy": [
184
184
  {
185
- "uid": "298b-124"
185
+ "uid": "ea8f-124"
186
186
  }
187
187
  ]
188
188
  },
189
- "298b-124": {
189
+ "ea8f-124": {
190
190
  "id": "/packages/react-router/src/index.tsx",
191
191
  "moduleParts": {
192
- "index.production.js": "298b-125"
192
+ "index.production.js": "ea8f-125"
193
193
  },
194
194
  "imported": [
195
195
  {
196
- "uid": "298b-112"
196
+ "uid": "ea8f-112"
197
197
  },
198
198
  {
199
- "uid": "298b-126"
199
+ "uid": "ea8f-126"
200
200
  },
201
201
  {
202
- "uid": "298b-120"
202
+ "uid": "ea8f-120"
203
203
  },
204
204
  {
205
- "uid": "298b-122"
205
+ "uid": "ea8f-122"
206
206
  }
207
207
  ],
208
208
  "importedBy": [],
209
209
  "isEntry": true
210
210
  },
211
- "298b-126": {
211
+ "ea8f-126": {
212
212
  "id": "react",
213
213
  "moduleParts": {},
214
214
  "imported": [],
215
215
  "importedBy": [
216
216
  {
217
- "uid": "298b-124"
217
+ "uid": "ea8f-124"
218
218
  }
219
219
  ],
220
220
  "isExternal": true
221
221
  },
222
- "298b-127": {
222
+ "ea8f-127": {
223
223
  "id": "use-sync-external-store/shim/with-selector",
224
224
  "moduleParts": {},
225
225
  "imported": [],
226
226
  "importedBy": [
227
227
  {
228
- "uid": "298b-122"
228
+ "uid": "ea8f-122"
229
229
  }
230
230
  ],
231
231
  "isExternal": true
@@ -1170,9 +1170,11 @@
1170
1170
  return matches;
1171
1171
  };
1172
1172
  loadMatches = async (resolvedMatches, location, opts) => {
1173
+ let firstBadMatchIndex;
1174
+
1173
1175
  // Check each match middleware to see if the route can be accessed
1174
1176
  try {
1175
- await Promise.all(resolvedMatches.map(async match => {
1177
+ await Promise.all(resolvedMatches.map(async (match, index) => {
1176
1178
  try {
1177
1179
  await match.route.options.beforeLoad?.({
1178
1180
  router: this,
@@ -1182,9 +1184,28 @@
1182
1184
  if (isRedirect(err)) {
1183
1185
  throw err;
1184
1186
  }
1187
+ firstBadMatchIndex = firstBadMatchIndex ?? index;
1185
1188
  const errorHandler = match.route.options.onBeforeLoadError ?? match.route.options.onError;
1186
- errorHandler?.(err);
1187
- throw err;
1189
+ try {
1190
+ errorHandler?.(err);
1191
+ } catch (errorHandlerErr) {
1192
+ if (isRedirect(errorHandlerErr)) {
1193
+ throw errorHandlerErr;
1194
+ }
1195
+ match.__store.setState(s => ({
1196
+ ...s,
1197
+ error: errorHandlerErr,
1198
+ status: 'error',
1199
+ updatedAt: Date.now()
1200
+ }));
1201
+ return;
1202
+ }
1203
+ match.__store.setState(s => ({
1204
+ ...s,
1205
+ error: err,
1206
+ status: 'error',
1207
+ updatedAt: Date.now()
1208
+ }));
1188
1209
  }
1189
1210
  }));
1190
1211
  } catch (err) {
@@ -1194,10 +1215,12 @@
1194
1215
  }
1195
1216
  return;
1196
1217
  }
1197
- throw err;
1218
+ throw err; // we should never end up here
1198
1219
  }
1199
- const matchPromises = resolvedMatches.map(async (match, index) => {
1200
- const parentMatch = resolvedMatches[index - 1];
1220
+
1221
+ const validResolvedMatches = resolvedMatches.slice(0, firstBadMatchIndex);
1222
+ const matchPromises = validResolvedMatches.map(async (match, index) => {
1223
+ const parentMatch = validResolvedMatches[index - 1];
1201
1224
  match.__load({
1202
1225
  preload: opts?.preload,
1203
1226
  location,