react-router 0.0.0-experimental-3e5084cc → 0.0.0-experimental-8f9ef191
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/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/dist/lib/components.d.ts +4 -4
- package/dist/lib/context.d.ts +4 -4
- package/dist/main.js +1 -1
- package/dist/react-router.development.js +17 -17
- package/dist/react-router.development.js.map +1 -1
- package/dist/react-router.production.min.js +2 -2
- package/dist/react-router.production.min.js.map +1 -1
- package/dist/umd/react-router.development.js +17 -17
- package/dist/umd/react-router.development.js.map +1 -1
- package/dist/umd/react-router.production.min.js +2 -2
- package/dist/umd/react-router.production.min.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Router v0.0.0-experimental-
|
|
2
|
+
* React Router v0.0.0-experimental-8f9ef191
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -538,14 +538,14 @@ function _renderMatches(matches, parentMatches, dataRouterState, future) {
|
|
|
538
538
|
}
|
|
539
539
|
|
|
540
540
|
// If we're in a partial hydration mode, detect if we need to render down to
|
|
541
|
-
// a given
|
|
541
|
+
// a given HydrateFallback while we load the rest of the hydration data
|
|
542
542
|
let renderFallback = false;
|
|
543
543
|
let fallbackIndex = -1;
|
|
544
544
|
if (dataRouterState && future && future.v7_partialHydration) {
|
|
545
545
|
for (let i = 0; i < renderedMatches.length; i++) {
|
|
546
546
|
let match = renderedMatches[i];
|
|
547
547
|
// Track the deepest fallback up until the first route without data
|
|
548
|
-
if (match.route.
|
|
548
|
+
if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
|
|
549
549
|
fallbackIndex = i;
|
|
550
550
|
}
|
|
551
551
|
if (match.route.loader && match.route.id && dataRouterState.loaderData[match.route.id] === undefined && (!dataRouterState.errors || dataRouterState.errors[match.route.id] === undefined)) {
|
|
@@ -565,20 +565,20 @@ function _renderMatches(matches, parentMatches, dataRouterState, future) {
|
|
|
565
565
|
return renderedMatches.reduceRight((outlet, match, index) => {
|
|
566
566
|
// Only data routers handle errors/fallbacks
|
|
567
567
|
let error;
|
|
568
|
-
let
|
|
568
|
+
let shouldRenderHydrateFallback = false;
|
|
569
569
|
let errorElement = null;
|
|
570
|
-
let
|
|
570
|
+
let hydrateFallbackElement = null;
|
|
571
571
|
if (dataRouterState) {
|
|
572
572
|
error = errors && match.route.id ? errors[match.route.id] : null;
|
|
573
573
|
errorElement = match.route.errorElement || defaultErrorElement;
|
|
574
574
|
if (renderFallback) {
|
|
575
575
|
if (fallbackIndex < 0 && index === 0) {
|
|
576
|
-
warningOnce("route-fallback", false, "No `
|
|
577
|
-
|
|
578
|
-
|
|
576
|
+
warningOnce("route-fallback", false, "No `HydrateFallback` element provided to render during initial hydration");
|
|
577
|
+
shouldRenderHydrateFallback = true;
|
|
578
|
+
hydrateFallbackElement = null;
|
|
579
579
|
} else if (fallbackIndex === index) {
|
|
580
|
-
|
|
581
|
-
|
|
580
|
+
shouldRenderHydrateFallback = true;
|
|
581
|
+
hydrateFallbackElement = match.route.hydrateFallbackElement || null;
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
584
|
}
|
|
@@ -587,8 +587,8 @@ function _renderMatches(matches, parentMatches, dataRouterState, future) {
|
|
|
587
587
|
let children;
|
|
588
588
|
if (error) {
|
|
589
589
|
children = errorElement;
|
|
590
|
-
} else if (
|
|
591
|
-
children =
|
|
590
|
+
} else if (shouldRenderHydrateFallback) {
|
|
591
|
+
children = hydrateFallbackElement;
|
|
592
592
|
} else if (match.route.Component) {
|
|
593
593
|
// Note: This is a de-optimized path since React won't re-use the
|
|
594
594
|
// ReactElement since it's identity changes with each new
|
|
@@ -1368,15 +1368,15 @@ function mapRouteProperties(route) {
|
|
|
1368
1368
|
Component: undefined
|
|
1369
1369
|
});
|
|
1370
1370
|
}
|
|
1371
|
-
if (route.
|
|
1371
|
+
if (route.HydrateFallback) {
|
|
1372
1372
|
if (process.env.NODE_ENV !== "production") {
|
|
1373
|
-
if (route.
|
|
1374
|
-
process.env.NODE_ENV !== "production" ? UNSAFE_warning(false, "You should not include both `
|
|
1373
|
+
if (route.hydrateFallbackElement) {
|
|
1374
|
+
process.env.NODE_ENV !== "production" ? UNSAFE_warning(false, "You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - " + "`HydrateFallback` will be used.") : void 0;
|
|
1375
1375
|
}
|
|
1376
1376
|
}
|
|
1377
1377
|
Object.assign(updates, {
|
|
1378
|
-
|
|
1379
|
-
|
|
1378
|
+
hydrateFallbackElement: /*#__PURE__*/React.createElement(route.HydrateFallback),
|
|
1379
|
+
HydrateFallback: undefined
|
|
1380
1380
|
});
|
|
1381
1381
|
}
|
|
1382
1382
|
if (route.ErrorBoundary) {
|