@tanstack/react-router 0.0.1-beta.11 → 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.
- package/build/cjs/react-router/src/index.js +81 -98
- package/build/cjs/react-router/src/index.js.map +1 -1
- package/build/cjs/router-core/build/esm/index.js +76 -111
- package/build/cjs/router-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +113 -171
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +43 -29
- package/build/types/index.d.ts +12 -3
- package/build/umd/index.development.js +121 -174
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +3 -2
- package/src/index.tsx +60 -74
package/build/esm/index.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
13
|
+
export { lazyWithPreload as lazy } from 'react-lazy-with-preload/lib/index';
|
|
13
14
|
|
|
14
15
|
function _extends$2() {
|
|
15
16
|
_extends$2 = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -1427,7 +1428,7 @@ const createRouteConfig = function createRouteConfig(options, children, isRoot,
|
|
|
1427
1428
|
};
|
|
1428
1429
|
};
|
|
1429
1430
|
|
|
1430
|
-
const
|
|
1431
|
+
const componentTypes = ['component', 'errorComponent', 'pendingComponent'];
|
|
1431
1432
|
function createRouteMatch(router, route, opts) {
|
|
1432
1433
|
const routeMatch = _extends({}, route, opts, {
|
|
1433
1434
|
router,
|
|
@@ -1437,7 +1438,6 @@ function createRouteMatch(router, route, opts) {
|
|
|
1437
1438
|
status: 'idle',
|
|
1438
1439
|
routeLoaderData: {},
|
|
1439
1440
|
loaderData: {},
|
|
1440
|
-
isPending: false,
|
|
1441
1441
|
isFetching: false,
|
|
1442
1442
|
isInvalid: false,
|
|
1443
1443
|
invalidAt: Infinity,
|
|
@@ -1455,32 +1455,6 @@ function createRouteMatch(router, route, opts) {
|
|
|
1455
1455
|
|
|
1456
1456
|
routeMatch.router.notify();
|
|
1457
1457
|
},
|
|
1458
|
-
startPending: () => {
|
|
1459
|
-
var _routeMatch$options$p, _routeMatch$options$p2;
|
|
1460
|
-
|
|
1461
|
-
const pendingMs = (_routeMatch$options$p = routeMatch.options.pendingMs) != null ? _routeMatch$options$p : router.options.defaultPendingMs;
|
|
1462
|
-
const pendingMinMs = (_routeMatch$options$p2 = routeMatch.options.pendingMinMs) != null ? _routeMatch$options$p2 : router.options.defaultPendingMinMs;
|
|
1463
|
-
|
|
1464
|
-
if (routeMatch.__.pendingTimeout || routeMatch.status !== 'loading' || typeof pendingMs === 'undefined') {
|
|
1465
|
-
return;
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
routeMatch.__.pendingTimeout = setTimeout(() => {
|
|
1469
|
-
routeMatch.isPending = true;
|
|
1470
|
-
|
|
1471
|
-
routeMatch.__.resolve();
|
|
1472
|
-
|
|
1473
|
-
if (typeof pendingMinMs !== 'undefined') {
|
|
1474
|
-
routeMatch.__.pendingMinPromise = new Promise(r => routeMatch.__.pendingMinTimeout = setTimeout(r, pendingMinMs));
|
|
1475
|
-
}
|
|
1476
|
-
}, pendingMs);
|
|
1477
|
-
},
|
|
1478
|
-
cancelPending: () => {
|
|
1479
|
-
routeMatch.isPending = false;
|
|
1480
|
-
clearTimeout(routeMatch.__.pendingTimeout);
|
|
1481
|
-
clearTimeout(routeMatch.__.pendingMinTimeout);
|
|
1482
|
-
delete routeMatch.__.pendingMinPromise;
|
|
1483
|
-
},
|
|
1484
1458
|
validate: () => {
|
|
1485
1459
|
var _routeMatch$parentMat, _routeMatch$parentMat2;
|
|
1486
1460
|
|
|
@@ -1500,11 +1474,11 @@ function createRouteMatch(router, route, opts) {
|
|
|
1500
1474
|
|
|
1501
1475
|
routeMatch.routeSearch = nextSearch;
|
|
1502
1476
|
routeMatch.search = replaceEqualDeep(parentSearch, _extends({}, parentSearch, nextSearch));
|
|
1503
|
-
|
|
1504
|
-
const
|
|
1477
|
+
componentTypes.map(async type => {
|
|
1478
|
+
const component = routeMatch.options[type];
|
|
1505
1479
|
|
|
1506
1480
|
if (typeof routeMatch.__[type] !== 'function') {
|
|
1507
|
-
routeMatch.__[type] =
|
|
1481
|
+
routeMatch.__[type] = component;
|
|
1508
1482
|
}
|
|
1509
1483
|
});
|
|
1510
1484
|
} catch (err) {
|
|
@@ -1524,14 +1498,16 @@ function createRouteMatch(router, route, opts) {
|
|
|
1524
1498
|
var _routeMatch$__$abortC;
|
|
1525
1499
|
|
|
1526
1500
|
(_routeMatch$__$abortC = routeMatch.__.abortController) == null ? void 0 : _routeMatch$__$abortC.abort();
|
|
1527
|
-
|
|
1528
|
-
routeMatch.__.cancelPending();
|
|
1529
1501
|
},
|
|
1530
1502
|
invalidate: () => {
|
|
1531
1503
|
routeMatch.isInvalid = true;
|
|
1532
1504
|
},
|
|
1533
1505
|
hasLoaders: () => {
|
|
1534
|
-
return !!(route.options.loader ||
|
|
1506
|
+
return !!(route.options.loader || componentTypes.some(d => {
|
|
1507
|
+
var _route$options$d;
|
|
1508
|
+
|
|
1509
|
+
return (_route$options$d = route.options[d]) == null ? void 0 : _route$options$d.preload;
|
|
1510
|
+
}));
|
|
1535
1511
|
},
|
|
1536
1512
|
load: async loaderOpts => {
|
|
1537
1513
|
const now = Date.now();
|
|
@@ -1575,91 +1551,79 @@ function createRouteMatch(router, route, opts) {
|
|
|
1575
1551
|
routeMatch.isFetching = true;
|
|
1576
1552
|
routeMatch.__.resolve = resolve;
|
|
1577
1553
|
|
|
1578
|
-
routeMatch.__.
|
|
1579
|
-
//
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
await Promise.all(elementTypes.map(async type => {
|
|
1584
|
-
const routeElement = routeMatch.options[type];
|
|
1554
|
+
routeMatch.__.componentsPromise = (async () => {
|
|
1555
|
+
// then run all component and data loaders in parallel
|
|
1556
|
+
// For each component type, potentially load it asynchronously
|
|
1557
|
+
await Promise.all(componentTypes.map(async type => {
|
|
1558
|
+
var _routeMatch$__$type;
|
|
1585
1559
|
|
|
1586
|
-
|
|
1587
|
-
routeMatch.__[type] = await router.options.createElement(routeElement);
|
|
1588
|
-
}
|
|
1589
|
-
}));
|
|
1590
|
-
})();
|
|
1591
|
-
|
|
1592
|
-
routeMatch.__.dataPromise = Promise.resolve().then(async () => {
|
|
1593
|
-
try {
|
|
1594
|
-
var _ref, _ref2, _opts$maxAge;
|
|
1595
|
-
|
|
1596
|
-
if (routeMatch.options.loader) {
|
|
1597
|
-
const data = await routeMatch.options.loader({
|
|
1598
|
-
params: routeMatch.params,
|
|
1599
|
-
search: routeMatch.routeSearch,
|
|
1600
|
-
signal: routeMatch.__.abortController.signal
|
|
1601
|
-
});
|
|
1602
|
-
|
|
1603
|
-
if (id !== routeMatch.__.latestId) {
|
|
1604
|
-
return routeMatch.__.loadPromise;
|
|
1605
|
-
}
|
|
1560
|
+
const component = routeMatch.options[type];
|
|
1606
1561
|
|
|
1607
|
-
|
|
1608
|
-
|
|
1562
|
+
if ((_routeMatch$__$type = routeMatch.__[type]) != null && _routeMatch$__$type.preload) {
|
|
1563
|
+
routeMatch.__[type] = await router.options.loadComponent(component);
|
|
1564
|
+
}
|
|
1565
|
+
}));
|
|
1566
|
+
})();
|
|
1567
|
+
|
|
1568
|
+
routeMatch.__.dataPromise = Promise.resolve().then(async () => {
|
|
1569
|
+
try {
|
|
1570
|
+
var _ref, _ref2, _opts$maxAge;
|
|
1571
|
+
|
|
1572
|
+
if (routeMatch.options.loader) {
|
|
1573
|
+
const data = await routeMatch.options.loader({
|
|
1574
|
+
params: routeMatch.params,
|
|
1575
|
+
search: routeMatch.routeSearch,
|
|
1576
|
+
signal: routeMatch.__.abortController.signal
|
|
1577
|
+
});
|
|
1609
1578
|
|
|
1610
|
-
routeMatch.error = undefined;
|
|
1611
|
-
routeMatch.status = 'success';
|
|
1612
|
-
routeMatch.updatedAt = Date.now();
|
|
1613
|
-
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);
|
|
1614
|
-
} catch (err) {
|
|
1615
1579
|
if (id !== routeMatch.__.latestId) {
|
|
1616
1580
|
return routeMatch.__.loadPromise;
|
|
1617
1581
|
}
|
|
1618
1582
|
|
|
1619
|
-
|
|
1620
|
-
console.error(err);
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
|
-
routeMatch.error = err;
|
|
1624
|
-
routeMatch.status = 'error';
|
|
1625
|
-
routeMatch.updatedAt = Date.now();
|
|
1583
|
+
routeMatch.routeLoaderData = replaceEqualDeep(routeMatch.routeLoaderData, data);
|
|
1626
1584
|
}
|
|
1627
|
-
});
|
|
1628
|
-
|
|
1629
|
-
try {
|
|
1630
|
-
await Promise.all([routeMatch.__.elementsPromise, routeMatch.__.dataPromise]);
|
|
1631
1585
|
|
|
1586
|
+
routeMatch.error = undefined;
|
|
1587
|
+
routeMatch.status = 'success';
|
|
1588
|
+
routeMatch.updatedAt = Date.now();
|
|
1589
|
+
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);
|
|
1590
|
+
} catch (err) {
|
|
1632
1591
|
if (id !== routeMatch.__.latestId) {
|
|
1633
1592
|
return routeMatch.__.loadPromise;
|
|
1634
1593
|
}
|
|
1635
1594
|
|
|
1636
|
-
if (
|
|
1637
|
-
|
|
1638
|
-
delete routeMatch.__.pendingMinPromise;
|
|
1639
|
-
}
|
|
1640
|
-
} finally {
|
|
1641
|
-
if (id !== routeMatch.__.latestId) {
|
|
1642
|
-
return routeMatch.__.loadPromise;
|
|
1595
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1596
|
+
console.error(err);
|
|
1643
1597
|
}
|
|
1644
1598
|
|
|
1645
|
-
routeMatch.
|
|
1599
|
+
routeMatch.error = err;
|
|
1600
|
+
routeMatch.status = 'error';
|
|
1601
|
+
routeMatch.updatedAt = Date.now();
|
|
1602
|
+
}
|
|
1603
|
+
});
|
|
1646
1604
|
|
|
1647
|
-
|
|
1648
|
-
|
|
1605
|
+
try {
|
|
1606
|
+
await Promise.all([routeMatch.__.componentsPromise, routeMatch.__.dataPromise]);
|
|
1649
1607
|
|
|
1650
|
-
|
|
1608
|
+
if (id !== routeMatch.__.latestId) {
|
|
1609
|
+
return routeMatch.__.loadPromise;
|
|
1610
|
+
}
|
|
1611
|
+
} finally {
|
|
1612
|
+
if (id !== routeMatch.__.latestId) {
|
|
1613
|
+
return routeMatch.__.loadPromise;
|
|
1651
1614
|
}
|
|
1652
|
-
})();
|
|
1653
1615
|
|
|
1654
|
-
|
|
1616
|
+
routeMatch.isFetching = false;
|
|
1655
1617
|
|
|
1656
|
-
|
|
1657
|
-
return routeMatch.__.loadPromise;
|
|
1618
|
+
routeMatch.__.notify();
|
|
1658
1619
|
}
|
|
1659
|
-
|
|
1660
|
-
delete routeMatch.__.loaderDataPromise;
|
|
1661
1620
|
});
|
|
1662
1621
|
await routeMatch.__.loadPromise;
|
|
1622
|
+
|
|
1623
|
+
if (id !== routeMatch.__.latestId) {
|
|
1624
|
+
return routeMatch.__.loadPromise;
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1663
1627
|
delete routeMatch.__.loadPromise;
|
|
1664
1628
|
}
|
|
1665
1629
|
});
|
|
@@ -1895,18 +1859,26 @@ function createRouter(userOptions) {
|
|
|
1895
1859
|
const matches = router.matchRoutes(router.location.pathname, {
|
|
1896
1860
|
strictParseParams: true
|
|
1897
1861
|
});
|
|
1898
|
-
|
|
1899
|
-
|
|
1862
|
+
|
|
1863
|
+
if (typeof document !== 'undefined') {
|
|
1864
|
+
router.state = _extends({}, router.state, {
|
|
1865
|
+
pending: {
|
|
1866
|
+
matches: matches,
|
|
1867
|
+
location: router.location
|
|
1868
|
+
},
|
|
1869
|
+
status: 'loading'
|
|
1870
|
+
});
|
|
1871
|
+
} else {
|
|
1872
|
+
router.state = _extends({}, router.state, {
|
|
1900
1873
|
matches: matches,
|
|
1901
|
-
location: router.location
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
}
|
|
1874
|
+
location: router.location,
|
|
1875
|
+
status: 'loading'
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1905
1879
|
router.notify(); // Load the matches
|
|
1906
1880
|
|
|
1907
|
-
await router.loadMatches(matches
|
|
1908
|
-
withPending: true
|
|
1909
|
-
});
|
|
1881
|
+
await router.loadMatches(matches);
|
|
1910
1882
|
|
|
1911
1883
|
if (router.startedLoadingAt !== id) {
|
|
1912
1884
|
// Ignore side-effects of match loading
|
|
@@ -2128,14 +2100,8 @@ function createRouter(userOptions) {
|
|
|
2128
2100
|
|
|
2129
2101
|
match.load(loaderOpts);
|
|
2130
2102
|
|
|
2131
|
-
if (match.status === 'loading') {
|
|
2132
|
-
// If requested, start the pending timers
|
|
2133
|
-
if (loaderOpts != null && loaderOpts.withPending) match.__.startPending();
|
|
2134
|
-
}
|
|
2135
|
-
|
|
2136
2103
|
if (match.__.loadPromise) {
|
|
2137
2104
|
// Wait for the first sign of activity from the match
|
|
2138
|
-
// This might be completion, error, or a pending state
|
|
2139
2105
|
await match.__.loadPromise;
|
|
2140
2106
|
}
|
|
2141
2107
|
});
|
|
@@ -2587,6 +2553,12 @@ function createReactRouter(opts) {
|
|
|
2587
2553
|
next
|
|
2588
2554
|
} = linkInfo;
|
|
2589
2555
|
|
|
2556
|
+
const reactHandleClick = e => {
|
|
2557
|
+
React.startTransition(() => {
|
|
2558
|
+
handleClick(e);
|
|
2559
|
+
});
|
|
2560
|
+
};
|
|
2561
|
+
|
|
2590
2562
|
const composeHandlers = handlers => e => {
|
|
2591
2563
|
e.persist();
|
|
2592
2564
|
handlers.forEach(handler => {
|
|
@@ -2600,7 +2572,7 @@ function createReactRouter(opts) {
|
|
|
2600
2572
|
const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = functionalUpdate(inactiveProps, {})) != null ? _functionalUpdate2 : {};
|
|
2601
2573
|
return _extends$2({}, resolvedActiveProps, resolvedInactiveProps, rest, {
|
|
2602
2574
|
href: disabled ? undefined : next.href,
|
|
2603
|
-
onClick: composeHandlers([
|
|
2575
|
+
onClick: composeHandlers([reactHandleClick, onClick]),
|
|
2604
2576
|
onFocus: composeHandlers([handleFocus, onFocus]),
|
|
2605
2577
|
onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),
|
|
2606
2578
|
onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),
|
|
@@ -2680,18 +2652,12 @@ function createReactRouter(opts) {
|
|
|
2680
2652
|
const routeExt = makeRouteExt(route, router);
|
|
2681
2653
|
Object.assign(route, routeExt);
|
|
2682
2654
|
},
|
|
2683
|
-
|
|
2684
|
-
if (typeof
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
if (typeof res === 'object' && res.default) {
|
|
2688
|
-
return /*#__PURE__*/React.createElement(res.default);
|
|
2689
|
-
} else {
|
|
2690
|
-
return res;
|
|
2691
|
-
}
|
|
2655
|
+
loadComponent: async component => {
|
|
2656
|
+
if (component.preload && typeof document !== 'undefined') {
|
|
2657
|
+
component.preload(); // return await component.preload()
|
|
2692
2658
|
}
|
|
2693
2659
|
|
|
2694
|
-
return
|
|
2660
|
+
return component;
|
|
2695
2661
|
}
|
|
2696
2662
|
}));
|
|
2697
2663
|
return coreRouter;
|
|
@@ -2718,77 +2684,53 @@ function RouterProvider(_ref2) {
|
|
|
2718
2684
|
value: router.state.matches
|
|
2719
2685
|
}, children != null ? children : /*#__PURE__*/React.createElement(Outlet, null)));
|
|
2720
2686
|
}
|
|
2721
|
-
|
|
2722
2687
|
function useRouter() {
|
|
2723
2688
|
const value = React.useContext(routerContext);
|
|
2724
2689
|
warning(!value, 'useRouter must be used inside a <Router> component!');
|
|
2725
2690
|
useRouterSubscription(value.router);
|
|
2726
2691
|
return value.router;
|
|
2727
2692
|
}
|
|
2728
|
-
|
|
2729
2693
|
function useMatches() {
|
|
2730
2694
|
return React.useContext(matchesContext);
|
|
2731
2695
|
}
|
|
2732
|
-
|
|
2733
2696
|
function Outlet() {
|
|
2734
|
-
var _match$
|
|
2697
|
+
var _ref3, _match$__$pendingComp, _match$__$errorCompon;
|
|
2735
2698
|
|
|
2736
2699
|
const router = useRouter();
|
|
2737
2700
|
const matches = useMatches().slice(1);
|
|
2738
2701
|
const match = matches[0];
|
|
2702
|
+
const defaultPending = React.useCallback(() => null, []);
|
|
2739
2703
|
|
|
2740
2704
|
if (!match) {
|
|
2741
2705
|
return null;
|
|
2742
2706
|
}
|
|
2743
2707
|
|
|
2744
|
-
const
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2708
|
+
const PendingComponent = (_ref3 = (_match$__$pendingComp = match.__.pendingComponent) != null ? _match$__$pendingComp : router.options.defaultPendingComponent) != null ? _ref3 : defaultPending;
|
|
2709
|
+
const errorComponent = (_match$__$errorCompon = match.__.errorComponent) != null ? _match$__$errorCompon : router.options.defaultErrorComponent;
|
|
2710
|
+
return /*#__PURE__*/React.createElement(MatchesProvider, {
|
|
2711
|
+
value: matches
|
|
2712
|
+
}, /*#__PURE__*/React.createElement(React.Suspense, {
|
|
2713
|
+
fallback: /*#__PURE__*/React.createElement(PendingComponent, null)
|
|
2714
|
+
}, /*#__PURE__*/React.createElement(CatchBoundary, {
|
|
2715
|
+
errorComponent: errorComponent
|
|
2716
|
+
}, (() => {
|
|
2753
2717
|
if (match.status === 'error') {
|
|
2754
|
-
|
|
2755
|
-
return errorElement;
|
|
2756
|
-
}
|
|
2757
|
-
|
|
2758
|
-
if (match.options.useErrorBoundary || router.options.useErrorBoundary) {
|
|
2759
|
-
throw match.error;
|
|
2760
|
-
}
|
|
2761
|
-
|
|
2762
|
-
return /*#__PURE__*/React.createElement(DefaultErrorBoundary, {
|
|
2763
|
-
error: match.error
|
|
2764
|
-
});
|
|
2718
|
+
throw match.error;
|
|
2765
2719
|
}
|
|
2766
2720
|
|
|
2767
|
-
if (match.status === '
|
|
2768
|
-
|
|
2769
|
-
var _match$__$pendingElem;
|
|
2721
|
+
if (match.status === 'success') {
|
|
2722
|
+
var _ref4, _ref5;
|
|
2770
2723
|
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
if (match.options.pendingMs || pendingElement) {
|
|
2774
|
-
var _ref3;
|
|
2775
|
-
|
|
2776
|
-
return (_ref3 = pendingElement) != null ? _ref3 : null;
|
|
2777
|
-
}
|
|
2778
|
-
}
|
|
2779
|
-
|
|
2780
|
-
return null;
|
|
2724
|
+
return /*#__PURE__*/React.createElement((_ref4 = (_ref5 = match.__.component) != null ? _ref5 : router.options.defaultComponent) != null ? _ref4 : Outlet);
|
|
2781
2725
|
}
|
|
2782
2726
|
|
|
2783
|
-
|
|
2784
|
-
|
|
2727
|
+
if (match.__.loadPromise) {
|
|
2728
|
+
console.log(match.matchId, 'suspend');
|
|
2729
|
+
throw match.__.loadPromise;
|
|
2730
|
+
}
|
|
2785
2731
|
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
value: matches
|
|
2789
|
-
}, /*#__PURE__*/React.createElement(CatchBoundary, {
|
|
2790
|
-
catchElement: catchElement
|
|
2791
|
-
}, element));
|
|
2732
|
+
invariant(false, 'This should never happen!');
|
|
2733
|
+
})())));
|
|
2792
2734
|
}
|
|
2793
2735
|
|
|
2794
2736
|
class CatchBoundary extends React.Component {
|
|
@@ -2808,12 +2750,12 @@ class CatchBoundary extends React.Component {
|
|
|
2808
2750
|
}
|
|
2809
2751
|
|
|
2810
2752
|
render() {
|
|
2811
|
-
var _this$props$
|
|
2753
|
+
var _this$props$errorComp;
|
|
2812
2754
|
|
|
2813
|
-
const
|
|
2755
|
+
const errorComponent = (_this$props$errorComp = this.props.errorComponent) != null ? _this$props$errorComp : DefaultErrorBoundary;
|
|
2814
2756
|
|
|
2815
2757
|
if (this.state.error) {
|
|
2816
|
-
return
|
|
2758
|
+
return /*#__PURE__*/React.createElement(errorComponent, this.state);
|
|
2817
2759
|
}
|
|
2818
2760
|
|
|
2819
2761
|
return this.props.children;
|
|
@@ -2873,5 +2815,5 @@ function Prompt(_ref7) {
|
|
|
2873
2815
|
return children != null ? children : null;
|
|
2874
2816
|
}
|
|
2875
2817
|
|
|
2876
|
-
export { DefaultErrorBoundary, MatchesProvider, Outlet, Prompt, RouterProvider, cleanPath, createBrowserHistory, createHashHistory, createMemoryHistory, createReactRouter, createRoute, createRouteConfig, createRouteMatch, createRouter, decode, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, invariant, joinPaths, last, matchByPath, matchPathname, parsePathname, parseSearchWith, pick, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, usePrompt, warning };
|
|
2818
|
+
export { DefaultErrorBoundary, MatchesProvider, Outlet, Prompt, RouterProvider, cleanPath, createBrowserHistory, createHashHistory, createMemoryHistory, createReactRouter, createRoute, createRouteConfig, createRouteMatch, createRouter, decode, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, invariant, joinPaths, last, matchByPath, matchPathname, parsePathname, parseSearchWith, pick, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, useMatches, usePrompt, useRouter, warning };
|
|
2877
2819
|
//# sourceMappingURL=index.js.map
|