@tanstack/router-core 0.0.1-alpha.4 → 0.0.1-alpha.6

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":"c4e0-1","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"node_modules","children":[{"name":"@babel/runtime/helpers/esm/extends.js","uid":"c4e0-3"},{"name":"history/index.js","uid":"c4e0-5"},{"name":"tiny-invariant/dist/esm/tiny-invariant.js","uid":"c4e0-7"}]},{"name":"packages/router-core/src","children":[{"uid":"c4e0-9","name":"qss.ts"},{"uid":"c4e0-11","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"c4e0-1":{"renderedLength":437,"gzipLength":243,"brotliLength":0,"mainUid":"c4e0-0"},"c4e0-3":{"renderedLength":431,"gzipLength":240,"brotliLength":0,"mainUid":"c4e0-2"},"c4e0-5":{"renderedLength":20618,"gzipLength":3797,"brotliLength":0,"mainUid":"c4e0-4"},"c4e0-7":{"renderedLength":181,"gzipLength":129,"brotliLength":0,"mainUid":"c4e0-6"},"c4e0-9":{"renderedLength":1241,"gzipLength":523,"brotliLength":0,"mainUid":"c4e0-8"},"c4e0-11":{"renderedLength":46465,"gzipLength":10249,"brotliLength":0,"mainUid":"c4e0-10"}},"nodeMetas":{"c4e0-0":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"c4e0-1"},"imported":[],"importedBy":[{"uid":"c4e0-10"}]},"c4e0-2":{"id":"/node_modules/@babel/runtime/helpers/esm/extends.js","moduleParts":{"index.production.js":"c4e0-3"},"imported":[],"importedBy":[{"uid":"c4e0-4"}]},"c4e0-4":{"id":"/node_modules/history/index.js","moduleParts":{"index.production.js":"c4e0-5"},"imported":[{"uid":"c4e0-2"}],"importedBy":[{"uid":"c4e0-10"}]},"c4e0-6":{"id":"/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","moduleParts":{"index.production.js":"c4e0-7"},"imported":[],"importedBy":[{"uid":"c4e0-10"}]},"c4e0-8":{"id":"/packages/router-core/src/qss.ts","moduleParts":{"index.production.js":"c4e0-9"},"imported":[],"importedBy":[{"uid":"c4e0-10"}]},"c4e0-10":{"id":"/packages/router-core/src/index.ts","moduleParts":{"index.production.js":"c4e0-11"},"imported":[{"uid":"c4e0-0"},{"uid":"c4e0-4"},{"uid":"c4e0-6"},{"uid":"c4e0-8"}],"importedBy":[],"isEntry":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":"19e6-1","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"node_modules","children":[{"name":"@babel/runtime/helpers/esm/extends.js","uid":"19e6-3"},{"name":"history/index.js","uid":"19e6-5"},{"name":"tiny-invariant/dist/esm/tiny-invariant.js","uid":"19e6-7"}]},{"name":"packages/router-core/src","children":[{"uid":"19e6-9","name":"qss.ts"},{"uid":"19e6-11","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"19e6-1":{"renderedLength":437,"gzipLength":243,"brotliLength":0,"mainUid":"19e6-0"},"19e6-3":{"renderedLength":431,"gzipLength":240,"brotliLength":0,"mainUid":"19e6-2"},"19e6-5":{"renderedLength":20618,"gzipLength":3797,"brotliLength":0,"mainUid":"19e6-4"},"19e6-7":{"renderedLength":181,"gzipLength":129,"brotliLength":0,"mainUid":"19e6-6"},"19e6-9":{"renderedLength":1241,"gzipLength":523,"brotliLength":0,"mainUid":"19e6-8"},"19e6-11":{"renderedLength":46842,"gzipLength":10342,"brotliLength":0,"mainUid":"19e6-10"}},"nodeMetas":{"19e6-0":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"19e6-1"},"imported":[],"importedBy":[{"uid":"19e6-10"}]},"19e6-2":{"id":"/node_modules/@babel/runtime/helpers/esm/extends.js","moduleParts":{"index.production.js":"19e6-3"},"imported":[],"importedBy":[{"uid":"19e6-4"}]},"19e6-4":{"id":"/node_modules/history/index.js","moduleParts":{"index.production.js":"19e6-5"},"imported":[{"uid":"19e6-2"}],"importedBy":[{"uid":"19e6-10"}]},"19e6-6":{"id":"/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","moduleParts":{"index.production.js":"19e6-7"},"imported":[],"importedBy":[{"uid":"19e6-10"}]},"19e6-8":{"id":"/packages/router-core/src/qss.ts","moduleParts":{"index.production.js":"19e6-9"},"imported":[],"importedBy":[{"uid":"19e6-10"}]},"19e6-10":{"id":"/packages/router-core/src/index.ts","moduleParts":{"index.production.js":"19e6-11"},"imported":[{"uid":"19e6-0"},{"uid":"19e6-4"},{"uid":"19e6-6"},{"uid":"19e6-8"}],"importedBy":[],"isEntry":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": "c4e0-13",
10
+ "uid": "19e6-13",
11
11
  "name": "\u0000rollupPluginBabelHelpers.js"
12
12
  },
13
13
  {
@@ -15,15 +15,15 @@
15
15
  "children": [
16
16
  {
17
17
  "name": "@babel/runtime/helpers/esm/extends.js",
18
- "uid": "c4e0-15"
18
+ "uid": "19e6-15"
19
19
  },
20
20
  {
21
21
  "name": "history/index.js",
22
- "uid": "c4e0-17"
22
+ "uid": "19e6-17"
23
23
  },
24
24
  {
25
25
  "name": "tiny-invariant/dist/esm/tiny-invariant.js",
26
- "uid": "c4e0-19"
26
+ "uid": "19e6-19"
27
27
  }
28
28
  ]
29
29
  },
@@ -31,11 +31,11 @@
31
31
  "name": "packages/router-core/src",
32
32
  "children": [
33
33
  {
34
- "uid": "c4e0-21",
34
+ "uid": "19e6-21",
35
35
  "name": "qss.ts"
36
36
  },
37
37
  {
38
- "uid": "c4e0-23",
38
+ "uid": "19e6-23",
39
39
  "name": "index.ts"
40
40
  }
41
41
  ]
@@ -46,125 +46,125 @@
46
46
  "isRoot": true
47
47
  },
48
48
  "nodeParts": {
49
- "c4e0-13": {
49
+ "19e6-13": {
50
50
  "renderedLength": 437,
51
51
  "gzipLength": 243,
52
52
  "brotliLength": 0,
53
- "mainUid": "c4e0-12"
53
+ "mainUid": "19e6-12"
54
54
  },
55
- "c4e0-15": {
55
+ "19e6-15": {
56
56
  "renderedLength": 431,
57
57
  "gzipLength": 240,
58
58
  "brotliLength": 0,
59
- "mainUid": "c4e0-14"
59
+ "mainUid": "19e6-14"
60
60
  },
61
- "c4e0-17": {
61
+ "19e6-17": {
62
62
  "renderedLength": 20618,
63
63
  "gzipLength": 3797,
64
64
  "brotliLength": 0,
65
- "mainUid": "c4e0-16"
65
+ "mainUid": "19e6-16"
66
66
  },
67
- "c4e0-19": {
67
+ "19e6-19": {
68
68
  "renderedLength": 181,
69
69
  "gzipLength": 129,
70
70
  "brotliLength": 0,
71
- "mainUid": "c4e0-18"
71
+ "mainUid": "19e6-18"
72
72
  },
73
- "c4e0-21": {
73
+ "19e6-21": {
74
74
  "renderedLength": 1241,
75
75
  "gzipLength": 523,
76
76
  "brotliLength": 0,
77
- "mainUid": "c4e0-20"
77
+ "mainUid": "19e6-20"
78
78
  },
79
- "c4e0-23": {
80
- "renderedLength": 46465,
81
- "gzipLength": 10249,
79
+ "19e6-23": {
80
+ "renderedLength": 46842,
81
+ "gzipLength": 10342,
82
82
  "brotliLength": 0,
83
- "mainUid": "c4e0-22"
83
+ "mainUid": "19e6-22"
84
84
  }
85
85
  },
86
86
  "nodeMetas": {
87
- "c4e0-12": {
87
+ "19e6-12": {
88
88
  "id": "\u0000rollupPluginBabelHelpers.js",
89
89
  "moduleParts": {
90
- "index.production.js": "c4e0-13"
90
+ "index.production.js": "19e6-13"
91
91
  },
92
92
  "imported": [],
93
93
  "importedBy": [
94
94
  {
95
- "uid": "c4e0-22"
95
+ "uid": "19e6-22"
96
96
  }
97
97
  ]
98
98
  },
99
- "c4e0-14": {
99
+ "19e6-14": {
100
100
  "id": "/node_modules/@babel/runtime/helpers/esm/extends.js",
101
101
  "moduleParts": {
102
- "index.production.js": "c4e0-15"
102
+ "index.production.js": "19e6-15"
103
103
  },
104
104
  "imported": [],
105
105
  "importedBy": [
106
106
  {
107
- "uid": "c4e0-16"
107
+ "uid": "19e6-16"
108
108
  }
109
109
  ]
110
110
  },
111
- "c4e0-16": {
111
+ "19e6-16": {
112
112
  "id": "/node_modules/history/index.js",
113
113
  "moduleParts": {
114
- "index.production.js": "c4e0-17"
114
+ "index.production.js": "19e6-17"
115
115
  },
116
116
  "imported": [
117
117
  {
118
- "uid": "c4e0-14"
118
+ "uid": "19e6-14"
119
119
  }
120
120
  ],
121
121
  "importedBy": [
122
122
  {
123
- "uid": "c4e0-22"
123
+ "uid": "19e6-22"
124
124
  }
125
125
  ]
126
126
  },
127
- "c4e0-18": {
127
+ "19e6-18": {
128
128
  "id": "/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
129
129
  "moduleParts": {
130
- "index.production.js": "c4e0-19"
130
+ "index.production.js": "19e6-19"
131
131
  },
132
132
  "imported": [],
133
133
  "importedBy": [
134
134
  {
135
- "uid": "c4e0-22"
135
+ "uid": "19e6-22"
136
136
  }
137
137
  ]
138
138
  },
139
- "c4e0-20": {
139
+ "19e6-20": {
140
140
  "id": "/packages/router-core/src/qss.ts",
141
141
  "moduleParts": {
142
- "index.production.js": "c4e0-21"
142
+ "index.production.js": "19e6-21"
143
143
  },
144
144
  "imported": [],
145
145
  "importedBy": [
146
146
  {
147
- "uid": "c4e0-22"
147
+ "uid": "19e6-22"
148
148
  }
149
149
  ]
150
150
  },
151
- "c4e0-22": {
151
+ "19e6-22": {
152
152
  "id": "/packages/router-core/src/index.ts",
153
153
  "moduleParts": {
154
- "index.production.js": "c4e0-23"
154
+ "index.production.js": "19e6-23"
155
155
  },
156
156
  "imported": [
157
157
  {
158
- "uid": "c4e0-12"
158
+ "uid": "19e6-12"
159
159
  },
160
160
  {
161
- "uid": "c4e0-16"
161
+ "uid": "19e6-16"
162
162
  },
163
163
  {
164
- "uid": "c4e0-18"
164
+ "uid": "19e6-18"
165
165
  },
166
166
  {
167
- "uid": "c4e0-20"
167
+ "uid": "19e6-20"
168
168
  }
169
169
  ],
170
170
  "importedBy": [],
@@ -231,7 +231,8 @@ interface RouterState {
231
231
  matches: RouteMatch[];
232
232
  lastUpdated: number;
233
233
  loaderData: unknown;
234
- action?: ActionState;
234
+ currentAction?: ActionState;
235
+ latestAction?: ActionState;
235
236
  actions: Record<string, Action>;
236
237
  pending?: PendingState;
237
238
  }
@@ -318,7 +319,8 @@ interface RouterOptions<TRouteConfig extends AnyRouteConfig> {
318
319
  }
319
320
  interface Action<TPayload = unknown, TResponse = unknown> {
320
321
  submit: (submission?: TPayload) => Promise<TResponse>;
321
- latest?: ActionState;
322
+ current?: ActionState<TPayload, TResponse>;
323
+ latest?: ActionState<TPayload, TResponse>;
322
324
  pending: ActionState<TPayload, TResponse>[];
323
325
  }
324
326
  interface ActionState<TPayload = unknown, TResponse = unknown> {
@@ -344,6 +346,10 @@ interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInf
344
346
  routeTree: Route<TAllRouteInfo, RouteInfo>;
345
347
  routesById: RoutesById<TAllRouteInfo>;
346
348
  navigationPromise: Promise<void>;
349
+ removeActionQueue: {
350
+ action: Action;
351
+ actionState: ActionState;
352
+ }[];
347
353
  startedLoadingAt: number;
348
354
  destroy: () => void;
349
355
  resolveNavigation: () => void;
@@ -451,7 +457,9 @@ declare type SearchParamOptions<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TT
451
457
  } : {
452
458
  search: SearchReducer<TFromSchema, TToSchema>;
453
459
  };
454
- declare type SearchReducer<TFrom, TTo> = TTo | ((current: TFrom) => TTo);
460
+ declare type SearchReducer<TFrom, TTo> = {
461
+ [TKey in keyof TTo]: TTo[TKey];
462
+ } | ((current: TFrom) => TTo);
455
463
  declare type PathParamOptions<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo, TFromParams = RouteInfoByPath<TAllRouteInfo, TFrom>['allParams'], TToParams = RouteInfoByPath<TAllRouteInfo, TTo>['allParams']> = StartsWith<TFrom, TTo> extends true ? {
456
464
  params?: ParamsReducer<TFromParams, TToParams>;
457
465
  } : AnyPathParams extends TToParams ? {
@@ -495,8 +503,6 @@ interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo
495
503
  }) => void);
496
504
  abortController: AbortController;
497
505
  latestId: string;
498
- setParentMatch: (parentMatch: RouteMatch) => void;
499
- addChildMatch: (childMatch: RouteMatch) => void;
500
506
  validate: () => void;
501
507
  startPending: () => void;
502
508
  cancelPending: () => void;
@@ -505,6 +511,7 @@ interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo
505
511
  };
506
512
  cancel: () => void;
507
513
  load: () => Promise<void>;
514
+ invalidate: () => void;
508
515
  }
509
516
  declare function createRouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo>(router: Router<any, any>, route: Route<TAllRouteInfo, TRouteInfo>, opts: {
510
517
  matchId: string;
@@ -968,6 +968,7 @@
968
968
  let router = {
969
969
  options: originalOptions,
970
970
  listeners: [],
971
+ removeActionQueue: [],
971
972
  // Resolved after construction
972
973
  basepath: '',
973
974
  routeTree: undefined,
@@ -1091,12 +1092,14 @@
1091
1092
  strictParseParams: true
1092
1093
  });
1093
1094
  const toMatches = router.matchRoutes(pathname);
1094
- const prevParams = (_last = last(fromMatches)) == null ? void 0 : _last.params;
1095
+
1096
+ const prevParams = _extends$1({}, (_last = last(fromMatches)) == null ? void 0 : _last.params);
1097
+
1095
1098
  let nextParams = ((_dest$params = dest.params) != null ? _dest$params : true) === true ? prevParams : functionalUpdate(dest.params, prevParams);
1096
1099
 
1097
1100
  if (nextParams) {
1098
1101
  toMatches.map(d => d.options.stringifyParams).filter(Boolean).forEach(fn => {
1099
- Object.assign(nextParams, fn(nextParams));
1102
+ Object.assign({}, nextParams, fn(nextParams));
1100
1103
  });
1101
1104
  }
1102
1105
 
@@ -1201,20 +1204,30 @@
1201
1204
  if (next) {
1202
1205
  // Ingest the new location
1203
1206
  router.location = next;
1204
- } // Cancel any pending matches
1207
+ } // Clear out old actions
1208
+
1209
+
1210
+ router.removeActionQueue.forEach(_ref => {
1211
+ let {
1212
+ action,
1213
+ actionState
1214
+ } = _ref;
1205
1215
 
1216
+ if (router.state.currentAction === actionState) {
1217
+ router.state.currentAction = undefined;
1218
+ }
1219
+
1220
+ if (action.current === actionState) {
1221
+ action.current = undefined;
1222
+ }
1223
+ });
1224
+ router.removeActionQueue = []; // Cancel any pending matches
1206
1225
 
1207
1226
  router.cancelMatches(); // Match the routes
1208
1227
 
1209
1228
  const unloadedMatches = router.matchRoutes(location.pathname, {
1210
1229
  strictParseParams: true
1211
1230
  });
1212
- unloadedMatches.forEach((match, index) => {
1213
- const parent = unloadedMatches[index - 1];
1214
- const child = unloadedMatches[index + 1];
1215
- if (parent) match.__.setParentMatch(parent);
1216
- if (child) match.__.addChildMatch(child);
1217
- });
1218
1231
  router.state = _extends$1({}, router.state, {
1219
1232
  pending: {
1220
1233
  matches: unloadedMatches,
@@ -1395,6 +1408,7 @@
1395
1408
  };
1396
1409
 
1397
1410
  recurse([router.routeTree]);
1411
+ cascadeLoaderData(matches);
1398
1412
  return matches;
1399
1413
  },
1400
1414
  loadMatches: async (resolvedMatches, loaderOpts) => {
@@ -1432,7 +1446,7 @@
1432
1446
  const unloadedMatchIds = router.matchRoutes(next.pathname).map(d => d.matchId);
1433
1447
  [...router.state.matches, ...((_router$state$pending5 = (_router$state$pending6 = router.state.pending) == null ? void 0 : _router$state$pending6.matches) != null ? _router$state$pending5 : [])].forEach(match => {
1434
1448
  if (unloadedMatchIds.includes(match.matchId)) {
1435
- match.isInvalid = true;
1449
+ match.invalidate();
1436
1450
  }
1437
1451
  });
1438
1452
  },
@@ -1473,14 +1487,15 @@
1473
1487
  const next = router.buildNext(location);
1474
1488
  return router.commitLocation(next, location.replace);
1475
1489
  },
1476
- navigate: async _ref => {
1490
+ navigate: async _ref2 => {
1477
1491
  let {
1478
1492
  from,
1479
1493
  to = '.',
1480
1494
  search,
1481
1495
  hash,
1482
- replace
1483
- } = _ref;
1496
+ replace,
1497
+ params
1498
+ } = _ref2;
1484
1499
  // If this link simply reloads the current route,
1485
1500
  // make sure it has a new key so it will trigger a data refresh
1486
1501
  // If this `to` is a valid external URL, return
@@ -1499,11 +1514,13 @@
1499
1514
  from: fromString,
1500
1515
  to: toString,
1501
1516
  search,
1502
- hash
1517
+ hash,
1518
+ replace,
1519
+ params
1503
1520
  });
1504
1521
  },
1505
- buildLink: _ref2 => {
1506
- var _preload, _ref3, _ref4;
1522
+ buildLink: _ref3 => {
1523
+ var _preload, _ref4, _ref5;
1507
1524
 
1508
1525
  let {
1509
1526
  from,
@@ -1518,7 +1535,7 @@
1518
1535
  preloadMaxAge: userPreloadMaxAge,
1519
1536
  preloadDelay: userPreloadDelay,
1520
1537
  disabled
1521
- } = _ref2;
1538
+ } = _ref3;
1522
1539
 
1523
1540
  // If this link simply reloads the current route,
1524
1541
  // make sure it has a new key so it will trigger a data refresh
@@ -1542,8 +1559,8 @@
1542
1559
  };
1543
1560
  const next = router.buildNext(nextOpts);
1544
1561
  preload = (_preload = preload) != null ? _preload : router.options.defaultLinkPreload;
1545
- const preloadMaxAge = (_ref3 = userPreloadMaxAge != null ? userPreloadMaxAge : router.options.defaultLinkPreloadMaxAge) != null ? _ref3 : 2000;
1546
- const preloadDelay = (_ref4 = userPreloadDelay != null ? userPreloadDelay : router.options.defaultLinkPreloadDelay) != null ? _ref4 : 50; // Compare path/hash for matches
1562
+ const preloadMaxAge = (_ref4 = userPreloadMaxAge != null ? userPreloadMaxAge : router.options.defaultLinkPreloadMaxAge) != null ? _ref4 : 2000;
1563
+ const preloadDelay = (_ref5 = userPreloadDelay != null ? userPreloadDelay : router.options.defaultLinkPreloadDelay) != null ? _ref5 : 50; // Compare path/hash for matches
1547
1564
 
1548
1565
  const pathIsEqual = router.state.location.pathname === next.pathname;
1549
1566
  const currentPathSplit = router.state.location.pathname.split('/');
@@ -1617,11 +1634,11 @@
1617
1634
  },
1618
1635
  __experimental__createSnapshot: () => {
1619
1636
  return _extends$1({}, router.state, {
1620
- matches: router.state.matches.map(_ref5 => {
1637
+ matches: router.state.matches.map(_ref6 => {
1621
1638
  let {
1622
1639
  routeLoaderData: loaderData,
1623
1640
  matchId
1624
- } = _ref5;
1641
+ } = _ref6;
1625
1642
  return {
1626
1643
  matchId,
1627
1644
  loaderData
@@ -1671,10 +1688,12 @@
1671
1688
  status: 'pending',
1672
1689
  submission
1673
1690
  };
1691
+ action.current = actionState;
1674
1692
  action.latest = actionState;
1675
1693
  action.pending.push(actionState);
1676
1694
  router.state = _extends$1({}, router.state, {
1677
- action: actionState
1695
+ currentAction: actionState,
1696
+ latestAction: actionState
1678
1697
  });
1679
1698
  router.notify();
1680
1699
 
@@ -1698,11 +1717,10 @@
1698
1717
  actionState.status = 'error';
1699
1718
  } finally {
1700
1719
  action.pending = action.pending.filter(d => d !== actionState);
1701
-
1702
- if (actionState === router.state.action) {
1703
- router.state.action = undefined;
1704
- }
1705
-
1720
+ router.removeActionQueue.push({
1721
+ action,
1722
+ actionState
1723
+ });
1706
1724
  router.notify();
1707
1725
  }
1708
1726
  }
@@ -1789,16 +1807,17 @@
1789
1807
  clearTimeout(routeMatch.__.pendingMinTimeout);
1790
1808
  delete routeMatch.__.pendingMinPromise;
1791
1809
  },
1792
- setParentMatch: parentMatch => {
1793
- routeMatch.parentMatch = parentMatch;
1794
- },
1795
- addChildMatch: childMatch => {
1796
- if (routeMatch.childMatches.find(d => d.matchId === childMatch.matchId)) {
1797
- return;
1798
- }
1799
-
1800
- routeMatch.childMatches.push(childMatch);
1801
- },
1810
+ // setParentMatch: (parentMatch?: RouteMatch) => {
1811
+ // routeMatch.parentMatch = parentMatch
1812
+ // },
1813
+ // addChildMatch: (childMatch: RouteMatch) => {
1814
+ // if (
1815
+ // routeMatch.childMatches.find((d) => d.matchId === childMatch.matchId)
1816
+ // ) {
1817
+ // return
1818
+ // }
1819
+ // routeMatch.childMatches.push(childMatch)
1820
+ // },
1802
1821
  validate: () => {
1803
1822
  var _routeMatch$parentMat, _routeMatch$parentMat2;
1804
1823
 
@@ -1835,6 +1854,9 @@
1835
1854
 
1836
1855
  routeMatch.__.cancelPending();
1837
1856
  },
1857
+ invalidate: () => {
1858
+ routeMatch.isInvalid = true;
1859
+ },
1838
1860
  load: async () => {
1839
1861
  const id = '' + Date.now() + Math.random();
1840
1862
  routeMatch.__.latestId = id; // If the match was in an error state, set it
@@ -1902,7 +1924,6 @@
1902
1924
  }
1903
1925
 
1904
1926
  routeMatch.routeLoaderData = replaceEqualDeep(routeMatch.routeLoaderData, data);
1905
- cascadeLoaderData(routeMatch);
1906
1927
  routeMatch.error = undefined;
1907
1928
  routeMatch.status = 'success';
1908
1929
  routeMatch.updatedAt = Date.now();
@@ -1962,16 +1983,14 @@
1962
1983
  return routeMatch;
1963
1984
  }
1964
1985
 
1965
- function cascadeLoaderData(routeMatch) {
1966
- if (routeMatch.parentMatch) {
1967
- routeMatch.loaderData = replaceEqualDeep(routeMatch.loaderData, _extends$1({}, routeMatch.parentMatch.loaderData, routeMatch.routeLoaderData));
1968
- }
1986
+ function cascadeLoaderData(matches) {
1987
+ matches.forEach((match, index) => {
1988
+ const parent = matches[index - 1];
1969
1989
 
1970
- if (routeMatch.childMatches.length) {
1971
- routeMatch.childMatches.forEach(childMatch => {
1972
- cascadeLoaderData(childMatch);
1973
- });
1974
- }
1990
+ if (parent) {
1991
+ match.loaderData = replaceEqualDeep(match.loaderData, _extends$1({}, parent.loaderData, match.routeLoaderData));
1992
+ }
1993
+ });
1975
1994
  }
1976
1995
 
1977
1996
  function matchPathname(currentPathname, matchLocation) {