@tanstack/react-router 0.0.1-beta.12 → 0.0.1-beta.13

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":"2ef3-59","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"2ef3-61"},{"name":"react-router/src/index.tsx","uid":"2ef3-63"}]}]}],"isRoot":true},"nodeParts":{"2ef3-59":{"renderedLength":798,"gzipLength":366,"brotliLength":0,"mainUid":"2ef3-58"},"2ef3-61":{"renderedLength":75522,"gzipLength":15692,"brotliLength":0,"mainUid":"2ef3-60"},"2ef3-63":{"renderedLength":11941,"gzipLength":3092,"brotliLength":0,"mainUid":"2ef3-62"}},"nodeMetas":{"2ef3-58":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"2ef3-59"},"imported":[],"importedBy":[{"uid":"2ef3-62"}]},"2ef3-60":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"2ef3-61"},"imported":[],"importedBy":[{"uid":"2ef3-62"}]},"2ef3-62":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"2ef3-63"},"imported":[{"uid":"2ef3-58"},{"uid":"2ef3-64"},{"uid":"2ef3-65"},{"uid":"2ef3-60"}],"importedBy":[],"isEntry":true},"2ef3-64":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"2ef3-62"}],"isExternal":true},"2ef3-65":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"2ef3-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":"c00e-59","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"c00e-61"},{"name":"react-router/src/index.tsx","uid":"c00e-63"}]}]}],"isRoot":true},"nodeParts":{"c00e-59":{"renderedLength":798,"gzipLength":366,"brotliLength":0,"mainUid":"c00e-58"},"c00e-61":{"renderedLength":73815,"gzipLength":15405,"brotliLength":0,"mainUid":"c00e-60"},"c00e-63":{"renderedLength":11547,"gzipLength":3026,"brotliLength":0,"mainUid":"c00e-62"}},"nodeMetas":{"c00e-58":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"c00e-59"},"imported":[],"importedBy":[{"uid":"c00e-62"}]},"c00e-60":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"c00e-61"},"imported":[],"importedBy":[{"uid":"c00e-62"}]},"c00e-62":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"c00e-63"},"imported":[{"uid":"c00e-58"},{"uid":"c00e-64"},{"uid":"c00e-65"},{"uid":"c00e-60"},{"uid":"c00e-66"}],"importedBy":[],"isEntry":true},"c00e-64":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"c00e-62"}],"isExternal":true},"c00e-65":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"c00e-62"}],"isExternal":true},"c00e-66":{"id":"react-lazy-with-preload/lib/index","moduleParts":{},"imported":[],"importedBy":[{"uid":"c00e-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": "2ef3-67",
10
+ "uid": "c00e-68",
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": "2ef3-69"
18
+ "uid": "c00e-70"
19
19
  },
20
20
  {
21
21
  "name": "react-router/src/index.tsx",
22
- "uid": "2ef3-71"
22
+ "uid": "c00e-72"
23
23
  }
24
24
  ]
25
25
  }
@@ -29,90 +29,104 @@
29
29
  "isRoot": true
30
30
  },
31
31
  "nodeParts": {
32
- "2ef3-67": {
32
+ "c00e-68": {
33
33
  "renderedLength": 798,
34
34
  "gzipLength": 366,
35
35
  "brotliLength": 0,
36
- "mainUid": "2ef3-66"
36
+ "mainUid": "c00e-67"
37
37
  },
38
- "2ef3-69": {
39
- "renderedLength": 75522,
40
- "gzipLength": 15692,
38
+ "c00e-70": {
39
+ "renderedLength": 73815,
40
+ "gzipLength": 15405,
41
41
  "brotliLength": 0,
42
- "mainUid": "2ef3-68"
42
+ "mainUid": "c00e-69"
43
43
  },
44
- "2ef3-71": {
45
- "renderedLength": 11941,
46
- "gzipLength": 3092,
44
+ "c00e-72": {
45
+ "renderedLength": 11547,
46
+ "gzipLength": 3026,
47
47
  "brotliLength": 0,
48
- "mainUid": "2ef3-70"
48
+ "mainUid": "c00e-71"
49
49
  }
50
50
  },
51
51
  "nodeMetas": {
52
- "2ef3-66": {
52
+ "c00e-67": {
53
53
  "id": "\u0000rollupPluginBabelHelpers.js",
54
54
  "moduleParts": {
55
- "index.production.js": "2ef3-67"
55
+ "index.production.js": "c00e-68"
56
56
  },
57
57
  "imported": [],
58
58
  "importedBy": [
59
59
  {
60
- "uid": "2ef3-70"
60
+ "uid": "c00e-71"
61
61
  }
62
62
  ]
63
63
  },
64
- "2ef3-68": {
64
+ "c00e-69": {
65
65
  "id": "/packages/router-core/build/esm/index.js",
66
66
  "moduleParts": {
67
- "index.production.js": "2ef3-69"
67
+ "index.production.js": "c00e-70"
68
68
  },
69
69
  "imported": [],
70
70
  "importedBy": [
71
71
  {
72
- "uid": "2ef3-70"
72
+ "uid": "c00e-71"
73
73
  }
74
74
  ]
75
75
  },
76
- "2ef3-70": {
76
+ "c00e-71": {
77
77
  "id": "/packages/react-router/src/index.tsx",
78
78
  "moduleParts": {
79
- "index.production.js": "2ef3-71"
79
+ "index.production.js": "c00e-72"
80
80
  },
81
81
  "imported": [
82
82
  {
83
- "uid": "2ef3-66"
83
+ "uid": "c00e-67"
84
84
  },
85
85
  {
86
- "uid": "2ef3-72"
86
+ "uid": "c00e-73"
87
87
  },
88
88
  {
89
- "uid": "2ef3-73"
89
+ "uid": "c00e-74"
90
90
  },
91
91
  {
92
- "uid": "2ef3-68"
92
+ "uid": "c00e-69"
93
+ },
94
+ {
95
+ "uid": "c00e-75"
93
96
  }
94
97
  ],
95
98
  "importedBy": [],
96
99
  "isEntry": true
97
100
  },
98
- "2ef3-72": {
101
+ "c00e-73": {
99
102
  "id": "react",
100
103
  "moduleParts": {},
101
104
  "imported": [],
102
105
  "importedBy": [
103
106
  {
104
- "uid": "2ef3-70"
107
+ "uid": "c00e-71"
105
108
  }
106
109
  ],
107
110
  "isExternal": true
108
111
  },
109
- "2ef3-73": {
112
+ "c00e-74": {
110
113
  "id": "use-sync-external-store/shim",
111
114
  "moduleParts": {},
112
115
  "imported": [],
113
116
  "importedBy": [
114
117
  {
115
- "uid": "2ef3-70"
118
+ "uid": "c00e-71"
119
+ }
120
+ ],
121
+ "isExternal": true
122
+ },
123
+ "c00e-75": {
124
+ "id": "react-lazy-with-preload/lib/index",
125
+ "moduleParts": {},
126
+ "imported": [],
127
+ "importedBy": [
128
+ {
129
+ "uid": "c00e-71"
116
130
  }
117
131
  ],
118
132
  "isExternal": true
@@ -11,11 +11,18 @@
11
11
  import * as React from 'react';
12
12
  import { AnyRouteConfig, RouteConfig, AnyAllRouteInfo, AllRouteInfo, RouterState, RouteMatch, ToOptions, MatchRouteOptions, RouteInfoByPath, ResolveRelativePath, NoInfer, DefaultAllRouteInfo, AnyRouteInfo, RouteInfo, CheckId, ToIdOption, ValidFromPath, LinkOptions, RouterOptions, Router } from '@tanstack/router-core';
13
13
  export * from '@tanstack/router-core';
14
+ export { lazyWithPreload as lazy } from 'react-lazy-with-preload/lib/index';
15
+ export { PreloadableComponent as LazyComponent } from 'react-lazy-with-preload';
14
16
 
17
+ declare type SyncRouteComponent = (props?: {}) => React.ReactNode;
18
+ declare type RouteComponent = SyncRouteComponent & {
19
+ preload?: () => Promise<{
20
+ default: SyncRouteComponent;
21
+ }>;
22
+ };
15
23
  declare module '@tanstack/router-core' {
16
24
  interface FrameworkGenerics {
17
- Element: React.ReactNode;
18
- SyncOrAsyncElement: React.ReactNode | (() => Promise<any>);
25
+ Component: RouteComponent;
19
26
  }
20
27
  interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>> {
21
28
  useState: () => RouterState;
@@ -77,4 +84,4 @@ declare function DefaultErrorBoundary({ error }: {
77
84
  declare function usePrompt(message: string, when: boolean | any): void;
78
85
  declare function Prompt({ message, when, children }: PromptProps): React.ReactNode;
79
86
 
80
- export { DefaultErrorBoundary, MatchesProvider, MatchesProviderProps, Outlet, Prompt, PromptProps, RouterProps, RouterProvider, createReactRouter, useMatches, usePrompt, useRouter };
87
+ export { DefaultErrorBoundary, MatchesProvider, MatchesProviderProps, Outlet, Prompt, PromptProps, RouteComponent, RouterProps, RouterProvider, createReactRouter, useMatches, usePrompt, useRouter };
@@ -9,10 +9,10 @@
9
9
  * @license MIT
10
10
  */
11
11
  (function (global, factory) {
12
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('use-sync-external-store/shim')) :
13
- typeof define === 'function' && define.amd ? define(['exports', 'react', 'use-sync-external-store/shim'], factory) :
14
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactRouter = {}, global.React, global.shim));
15
- })(this, (function (exports, React, shim) { 'use strict';
12
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('use-sync-external-store/shim'), require('react-lazy-with-preload/lib/index')) :
13
+ typeof define === 'function' && define.amd ? define(['exports', 'react', 'use-sync-external-store/shim', 'react-lazy-with-preload/lib/index'], factory) :
14
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactRouter = {}, global.React, global.shim, global.index));
15
+ })(this, (function (exports, React, shim, index) { 'use strict';
16
16
 
17
17
  function _interopNamespace(e) {
18
18
  if (e && e.__esModule) return e;
@@ -1443,7 +1443,7 @@
1443
1443
  };
1444
1444
  };
1445
1445
 
1446
- const elementTypes = ['element', 'errorElement', 'catchElement', 'pendingElement'];
1446
+ const componentTypes = ['component', 'errorComponent', 'pendingComponent'];
1447
1447
  function createRouteMatch(router, route, opts) {
1448
1448
  const routeMatch = _extends({}, route, opts, {
1449
1449
  router,
@@ -1453,7 +1453,6 @@
1453
1453
  status: 'idle',
1454
1454
  routeLoaderData: {},
1455
1455
  loaderData: {},
1456
- isPending: false,
1457
1456
  isFetching: false,
1458
1457
  isInvalid: false,
1459
1458
  invalidAt: Infinity,
@@ -1471,32 +1470,6 @@
1471
1470
 
1472
1471
  routeMatch.router.notify();
1473
1472
  },
1474
- startPending: () => {
1475
- var _routeMatch$options$p, _routeMatch$options$p2;
1476
-
1477
- const pendingMs = (_routeMatch$options$p = routeMatch.options.pendingMs) != null ? _routeMatch$options$p : router.options.defaultPendingMs;
1478
- const pendingMinMs = (_routeMatch$options$p2 = routeMatch.options.pendingMinMs) != null ? _routeMatch$options$p2 : router.options.defaultPendingMinMs;
1479
-
1480
- if (routeMatch.__.pendingTimeout || routeMatch.status !== 'loading' || typeof pendingMs === 'undefined') {
1481
- return;
1482
- }
1483
-
1484
- routeMatch.__.pendingTimeout = setTimeout(() => {
1485
- routeMatch.isPending = true;
1486
-
1487
- routeMatch.__.resolve();
1488
-
1489
- if (typeof pendingMinMs !== 'undefined') {
1490
- routeMatch.__.pendingMinPromise = new Promise(r => routeMatch.__.pendingMinTimeout = setTimeout(r, pendingMinMs));
1491
- }
1492
- }, pendingMs);
1493
- },
1494
- cancelPending: () => {
1495
- routeMatch.isPending = false;
1496
- clearTimeout(routeMatch.__.pendingTimeout);
1497
- clearTimeout(routeMatch.__.pendingMinTimeout);
1498
- delete routeMatch.__.pendingMinPromise;
1499
- },
1500
1473
  validate: () => {
1501
1474
  var _routeMatch$parentMat, _routeMatch$parentMat2;
1502
1475
 
@@ -1516,11 +1489,11 @@
1516
1489
 
1517
1490
  routeMatch.routeSearch = nextSearch;
1518
1491
  routeMatch.search = replaceEqualDeep(parentSearch, _extends({}, parentSearch, nextSearch));
1519
- elementTypes.map(async type => {
1520
- const routeElement = routeMatch.options[type];
1492
+ componentTypes.map(async type => {
1493
+ const component = routeMatch.options[type];
1521
1494
 
1522
1495
  if (typeof routeMatch.__[type] !== 'function') {
1523
- routeMatch.__[type] = routeElement;
1496
+ routeMatch.__[type] = component;
1524
1497
  }
1525
1498
  });
1526
1499
  } catch (err) {
@@ -1540,14 +1513,16 @@
1540
1513
  var _routeMatch$__$abortC;
1541
1514
 
1542
1515
  (_routeMatch$__$abortC = routeMatch.__.abortController) == null ? void 0 : _routeMatch$__$abortC.abort();
1543
-
1544
- routeMatch.__.cancelPending();
1545
1516
  },
1546
1517
  invalidate: () => {
1547
1518
  routeMatch.isInvalid = true;
1548
1519
  },
1549
1520
  hasLoaders: () => {
1550
- return !!(route.options.loader || elementTypes.some(d => typeof route.options[d] === 'function'));
1521
+ return !!(route.options.loader || componentTypes.some(d => {
1522
+ var _route$options$d;
1523
+
1524
+ return (_route$options$d = route.options[d]) == null ? void 0 : _route$options$d.preload;
1525
+ }));
1551
1526
  },
1552
1527
  load: async loaderOpts => {
1553
1528
  const now = Date.now();
@@ -1591,91 +1566,79 @@
1591
1566
  routeMatch.isFetching = true;
1592
1567
  routeMatch.__.resolve = resolve;
1593
1568
 
1594
- routeMatch.__.loaderDataPromise = (async () => {
1595
- // Load the elements and data in parallel
1596
- routeMatch.__.elementsPromise = (async () => {
1597
- // then run all element and data loaders in parallel
1598
- // For each element type, potentially load it asynchronously
1599
- await Promise.all(elementTypes.map(async type => {
1600
- const routeElement = routeMatch.options[type];
1569
+ routeMatch.__.componentsPromise = (async () => {
1570
+ // then run all component and data loaders in parallel
1571
+ // For each component type, potentially load it asynchronously
1572
+ await Promise.all(componentTypes.map(async type => {
1573
+ var _routeMatch$__$type;
1601
1574
 
1602
- if (typeof routeMatch.__[type] === 'function') {
1603
- routeMatch.__[type] = await router.options.createElement(routeElement);
1604
- }
1605
- }));
1606
- })();
1607
-
1608
- routeMatch.__.dataPromise = Promise.resolve().then(async () => {
1609
- try {
1610
- var _ref, _ref2, _opts$maxAge;
1611
-
1612
- if (routeMatch.options.loader) {
1613
- const data = await routeMatch.options.loader({
1614
- params: routeMatch.params,
1615
- search: routeMatch.routeSearch,
1616
- signal: routeMatch.__.abortController.signal
1617
- });
1618
-
1619
- if (id !== routeMatch.__.latestId) {
1620
- return routeMatch.__.loadPromise;
1621
- }
1575
+ const component = routeMatch.options[type];
1622
1576
 
1623
- routeMatch.routeLoaderData = replaceEqualDeep(routeMatch.routeLoaderData, data);
1624
- }
1577
+ if ((_routeMatch$__$type = routeMatch.__[type]) != null && _routeMatch$__$type.preload) {
1578
+ routeMatch.__[type] = await router.options.loadComponent(component);
1579
+ }
1580
+ }));
1581
+ })();
1582
+
1583
+ routeMatch.__.dataPromise = Promise.resolve().then(async () => {
1584
+ try {
1585
+ var _ref, _ref2, _opts$maxAge;
1586
+
1587
+ if (routeMatch.options.loader) {
1588
+ const data = await routeMatch.options.loader({
1589
+ params: routeMatch.params,
1590
+ search: routeMatch.routeSearch,
1591
+ signal: routeMatch.__.abortController.signal
1592
+ });
1625
1593
 
1626
- routeMatch.error = undefined;
1627
- routeMatch.status = 'success';
1628
- routeMatch.updatedAt = Date.now();
1629
- routeMatch.invalidAt = routeMatch.updatedAt + ((_ref = (_ref2 = (_opts$maxAge = opts == null ? void 0 : opts.maxAge) != null ? _opts$maxAge : routeMatch.options.loaderMaxAge) != null ? _ref2 : router.options.defaultLoaderMaxAge) != null ? _ref : 0);
1630
- } catch (err) {
1631
1594
  if (id !== routeMatch.__.latestId) {
1632
1595
  return routeMatch.__.loadPromise;
1633
1596
  }
1634
1597
 
1635
- {
1636
- console.error(err);
1637
- }
1638
-
1639
- routeMatch.error = err;
1640
- routeMatch.status = 'error';
1641
- routeMatch.updatedAt = Date.now();
1598
+ routeMatch.routeLoaderData = replaceEqualDeep(routeMatch.routeLoaderData, data);
1642
1599
  }
1643
- });
1644
-
1645
- try {
1646
- await Promise.all([routeMatch.__.elementsPromise, routeMatch.__.dataPromise]);
1647
1600
 
1601
+ routeMatch.error = undefined;
1602
+ routeMatch.status = 'success';
1603
+ routeMatch.updatedAt = Date.now();
1604
+ routeMatch.invalidAt = routeMatch.updatedAt + ((_ref = (_ref2 = (_opts$maxAge = opts == null ? void 0 : opts.maxAge) != null ? _opts$maxAge : routeMatch.options.loaderMaxAge) != null ? _ref2 : router.options.defaultLoaderMaxAge) != null ? _ref : 0);
1605
+ } catch (err) {
1648
1606
  if (id !== routeMatch.__.latestId) {
1649
1607
  return routeMatch.__.loadPromise;
1650
1608
  }
1651
1609
 
1652
- if (routeMatch.__.pendingMinPromise) {
1653
- await routeMatch.__.pendingMinPromise;
1654
- delete routeMatch.__.pendingMinPromise;
1655
- }
1656
- } finally {
1657
- if (id !== routeMatch.__.latestId) {
1658
- return routeMatch.__.loadPromise;
1610
+ {
1611
+ console.error(err);
1659
1612
  }
1660
1613
 
1661
- routeMatch.__.cancelPending();
1614
+ routeMatch.error = err;
1615
+ routeMatch.status = 'error';
1616
+ routeMatch.updatedAt = Date.now();
1617
+ }
1618
+ });
1662
1619
 
1663
- routeMatch.isPending = false;
1664
- routeMatch.isFetching = false;
1620
+ try {
1621
+ await Promise.all([routeMatch.__.componentsPromise, routeMatch.__.dataPromise]);
1665
1622
 
1666
- routeMatch.__.notify();
1623
+ if (id !== routeMatch.__.latestId) {
1624
+ return routeMatch.__.loadPromise;
1625
+ }
1626
+ } finally {
1627
+ if (id !== routeMatch.__.latestId) {
1628
+ return routeMatch.__.loadPromise;
1667
1629
  }
1668
- })();
1669
1630
 
1670
- await routeMatch.__.loaderDataPromise;
1631
+ routeMatch.isFetching = false;
1671
1632
 
1672
- if (id !== routeMatch.__.latestId) {
1673
- return routeMatch.__.loadPromise;
1633
+ routeMatch.__.notify();
1674
1634
  }
1675
-
1676
- delete routeMatch.__.loaderDataPromise;
1677
1635
  });
1678
1636
  await routeMatch.__.loadPromise;
1637
+
1638
+ if (id !== routeMatch.__.latestId) {
1639
+ return routeMatch.__.loadPromise;
1640
+ }
1641
+
1679
1642
  delete routeMatch.__.loadPromise;
1680
1643
  }
1681
1644
  });
@@ -1911,18 +1874,26 @@
1911
1874
  const matches = router.matchRoutes(router.location.pathname, {
1912
1875
  strictParseParams: true
1913
1876
  });
1914
- router.state = _extends({}, router.state, {
1915
- pending: {
1877
+
1878
+ if (typeof document !== 'undefined') {
1879
+ router.state = _extends({}, router.state, {
1880
+ pending: {
1881
+ matches: matches,
1882
+ location: router.location
1883
+ },
1884
+ status: 'loading'
1885
+ });
1886
+ } else {
1887
+ router.state = _extends({}, router.state, {
1916
1888
  matches: matches,
1917
- location: router.location
1918
- },
1919
- status: 'loading'
1920
- });
1889
+ location: router.location,
1890
+ status: 'loading'
1891
+ });
1892
+ }
1893
+
1921
1894
  router.notify(); // Load the matches
1922
1895
 
1923
- await router.loadMatches(matches, {
1924
- withPending: true
1925
- });
1896
+ await router.loadMatches(matches);
1926
1897
 
1927
1898
  if (router.startedLoadingAt !== id) {
1928
1899
  // Ignore side-effects of match loading
@@ -2144,14 +2115,8 @@
2144
2115
 
2145
2116
  match.load(loaderOpts);
2146
2117
 
2147
- if (match.status === 'loading') {
2148
- // If requested, start the pending timers
2149
- if (loaderOpts != null && loaderOpts.withPending) match.__.startPending();
2150
- }
2151
-
2152
2118
  if (match.__.loadPromise) {
2153
2119
  // Wait for the first sign of activity from the match
2154
- // This might be completion, error, or a pending state
2155
2120
  await match.__.loadPromise;
2156
2121
  }
2157
2122
  });
@@ -2603,6 +2568,12 @@
2603
2568
  next
2604
2569
  } = linkInfo;
2605
2570
 
2571
+ const reactHandleClick = e => {
2572
+ React__namespace.startTransition(() => {
2573
+ handleClick(e);
2574
+ });
2575
+ };
2576
+
2606
2577
  const composeHandlers = handlers => e => {
2607
2578
  e.persist();
2608
2579
  handlers.forEach(handler => {
@@ -2616,7 +2587,7 @@
2616
2587
  const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = functionalUpdate(inactiveProps, {})) != null ? _functionalUpdate2 : {};
2617
2588
  return _extends$2({}, resolvedActiveProps, resolvedInactiveProps, rest, {
2618
2589
  href: disabled ? undefined : next.href,
2619
- onClick: composeHandlers([handleClick, onClick]),
2590
+ onClick: composeHandlers([reactHandleClick, onClick]),
2620
2591
  onFocus: composeHandlers([handleFocus, onFocus]),
2621
2592
  onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),
2622
2593
  onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),
@@ -2696,18 +2667,12 @@
2696
2667
  const routeExt = makeRouteExt(route, router);
2697
2668
  Object.assign(route, routeExt);
2698
2669
  },
2699
- createElement: async element => {
2700
- if (typeof element === 'function') {
2701
- const res = await element(); // Support direct import() calls
2702
-
2703
- if (typeof res === 'object' && res.default) {
2704
- return /*#__PURE__*/React__namespace.createElement(res.default);
2705
- } else {
2706
- return res;
2707
- }
2670
+ loadComponent: async component => {
2671
+ if (component.preload && typeof document !== 'undefined') {
2672
+ component.preload(); // return await component.preload()
2708
2673
  }
2709
2674
 
2710
- return element;
2675
+ return component;
2711
2676
  }
2712
2677
  }));
2713
2678
  return coreRouter;
@@ -2744,64 +2709,43 @@
2744
2709
  return React__namespace.useContext(matchesContext);
2745
2710
  }
2746
2711
  function Outlet() {
2747
- var _match$options$catchE;
2712
+ var _ref3, _match$__$pendingComp, _match$__$errorCompon;
2748
2713
 
2749
2714
  const router = useRouter();
2750
2715
  const matches = useMatches().slice(1);
2751
2716
  const match = matches[0];
2717
+ const defaultPending = React__namespace.useCallback(() => null, []);
2752
2718
 
2753
2719
  if (!match) {
2754
2720
  return null;
2755
2721
  }
2756
2722
 
2757
- const element = (() => {
2758
- var _match$__$errorElemen, _ref4, _ref5;
2759
-
2760
- if (!match) {
2761
- return null;
2762
- }
2763
-
2764
- const errorElement = (_match$__$errorElemen = match.__.errorElement) != null ? _match$__$errorElemen : router.options.defaultErrorElement;
2765
-
2723
+ const PendingComponent = (_ref3 = (_match$__$pendingComp = match.__.pendingComponent) != null ? _match$__$pendingComp : router.options.defaultPendingComponent) != null ? _ref3 : defaultPending;
2724
+ const errorComponent = (_match$__$errorCompon = match.__.errorComponent) != null ? _match$__$errorCompon : router.options.defaultErrorComponent;
2725
+ return /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
2726
+ value: matches
2727
+ }, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
2728
+ fallback: /*#__PURE__*/React__namespace.createElement(PendingComponent, null)
2729
+ }, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
2730
+ errorComponent: errorComponent
2731
+ }, (() => {
2766
2732
  if (match.status === 'error') {
2767
- if (errorElement) {
2768
- return errorElement;
2769
- }
2770
-
2771
- if (match.options.useErrorBoundary || router.options.useErrorBoundary) {
2772
- throw match.error;
2773
- }
2774
-
2775
- return /*#__PURE__*/React__namespace.createElement(DefaultErrorBoundary, {
2776
- error: match.error
2777
- });
2733
+ throw match.error;
2778
2734
  }
2779
2735
 
2780
- if (match.status === 'loading' || match.status === 'idle') {
2781
- if (match.isPending) {
2782
- var _match$__$pendingElem;
2736
+ if (match.status === 'success') {
2737
+ var _ref4, _ref5;
2783
2738
 
2784
- const pendingElement = (_match$__$pendingElem = match.__.pendingElement) != null ? _match$__$pendingElem : router.options.defaultPendingElement;
2785
-
2786
- if (match.options.pendingMs || pendingElement) {
2787
- var _ref3;
2788
-
2789
- return (_ref3 = pendingElement) != null ? _ref3 : null;
2790
- }
2791
- }
2792
-
2793
- return null;
2739
+ return /*#__PURE__*/React__namespace.createElement((_ref4 = (_ref5 = match.__.component) != null ? _ref5 : router.options.defaultComponent) != null ? _ref4 : Outlet);
2794
2740
  }
2795
2741
 
2796
- return (_ref4 = (_ref5 = match.__.element) != null ? _ref5 : router.options.defaultElement) != null ? _ref4 : /*#__PURE__*/React__namespace.createElement(Outlet, null);
2797
- })();
2742
+ if (match.__.loadPromise) {
2743
+ console.log(match.matchId, 'suspend');
2744
+ throw match.__.loadPromise;
2745
+ }
2798
2746
 
2799
- const catchElement = (_match$options$catchE = match == null ? void 0 : match.options.catchElement) != null ? _match$options$catchE : router.options.defaultCatchElement;
2800
- return /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
2801
- value: matches
2802
- }, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
2803
- catchElement: catchElement
2804
- }, element));
2747
+ invariant(false, 'This should never happen!');
2748
+ })())));
2805
2749
  }
2806
2750
 
2807
2751
  class CatchBoundary extends React__namespace.Component {
@@ -2821,12 +2765,12 @@
2821
2765
  }
2822
2766
 
2823
2767
  render() {
2824
- var _this$props$catchElem;
2768
+ var _this$props$errorComp;
2825
2769
 
2826
- const catchElement = (_this$props$catchElem = this.props.catchElement) != null ? _this$props$catchElem : DefaultErrorBoundary;
2770
+ const errorComponent = (_this$props$errorComp = this.props.errorComponent) != null ? _this$props$errorComp : DefaultErrorBoundary;
2827
2771
 
2828
2772
  if (this.state.error) {
2829
- return typeof catchElement === 'function' ? catchElement(this.state) : catchElement;
2773
+ return /*#__PURE__*/React__namespace.createElement(errorComponent, this.state);
2830
2774
  }
2831
2775
 
2832
2776
  return this.props.children;
@@ -2886,6 +2830,10 @@
2886
2830
  return children != null ? children : null;
2887
2831
  }
2888
2832
 
2833
+ Object.defineProperty(exports, 'lazy', {
2834
+ enumerable: true,
2835
+ get: function () { return index.lazyWithPreload; }
2836
+ });
2889
2837
  exports.DefaultErrorBoundary = DefaultErrorBoundary;
2890
2838
  exports.MatchesProvider = MatchesProvider;
2891
2839
  exports.Outlet = Outlet;