react-router 0.0.0-experimental-4841e12b → 0.0.0-experimental-3e5084cc

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v0.0.0-experimental-4841e12b
2
+ * React Router v0.0.0-experimental-3e5084cc
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -538,21 +538,17 @@ 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 Fallback while we load the rest of the hydration data
541
+ // a given InitialFallback 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.Fallback || match.route.fallbackElement) {
548
+ if (match.route.InitialFallback || match.route.initialFallbackElement) {
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)) {
552
- // TODO:
553
- // TODO: Add unit tests for this error flow!
554
- // TODO:
555
-
556
552
  // We found the first route without data/errors which means it's loader
557
553
  // still needs to run. Flag that we need to render a fallback and
558
554
  // render up until the appropriate fallback
@@ -569,20 +565,20 @@ function _renderMatches(matches, parentMatches, dataRouterState, future) {
569
565
  return renderedMatches.reduceRight((outlet, match, index) => {
570
566
  // Only data routers handle errors/fallbacks
571
567
  let error;
572
- let fallback = false;
568
+ let shouldRenderInitialFallback = false;
573
569
  let errorElement = null;
574
- let fallbackElement = null;
570
+ let initialFallbackElement = null;
575
571
  if (dataRouterState) {
576
572
  error = errors && match.route.id ? errors[match.route.id] : null;
577
573
  errorElement = match.route.errorElement || defaultErrorElement;
578
574
  if (renderFallback) {
579
575
  if (fallbackIndex < 0 && index === 0) {
580
- warningOnce("route-fallback", false, "No `Fallback` element provided to render during initial hydration");
581
- fallback = true;
582
- fallbackElement = null;
576
+ warningOnce("route-fallback", false, "No `InitialFallback` element provided to render during initial hydration");
577
+ shouldRenderInitialFallback = true;
578
+ initialFallbackElement = null;
583
579
  } else if (fallbackIndex === index) {
584
- fallback = true;
585
- fallbackElement = match.route.fallbackElement || null;
580
+ shouldRenderInitialFallback = true;
581
+ initialFallbackElement = match.route.initialFallbackElement || null;
586
582
  }
587
583
  }
588
584
  }
@@ -591,8 +587,8 @@ function _renderMatches(matches, parentMatches, dataRouterState, future) {
591
587
  let children;
592
588
  if (error) {
593
589
  children = errorElement;
594
- } else if (fallback) {
595
- children = fallbackElement;
590
+ } else if (shouldRenderInitialFallback) {
591
+ children = initialFallbackElement;
596
592
  } else if (match.route.Component) {
597
593
  // Note: This is a de-optimized path since React won't re-use the
598
594
  // ReactElement since it's identity changes with each new
@@ -1372,15 +1368,15 @@ function mapRouteProperties(route) {
1372
1368
  Component: undefined
1373
1369
  });
1374
1370
  }
1375
- if (route.Fallback) {
1371
+ if (route.InitialFallback) {
1376
1372
  if (process.env.NODE_ENV !== "production") {
1377
- if (route.fallbackElement) {
1378
- process.env.NODE_ENV !== "production" ? UNSAFE_warning(false, "You should not include both `Fallback` and `fallbackElement` on your route - " + "`Fallback` will be used.") : void 0;
1373
+ if (route.initialFallbackElement) {
1374
+ process.env.NODE_ENV !== "production" ? UNSAFE_warning(false, "You should not include both `InitialFallback` and `initialFallbackElement` on your route - " + "`InitialFallback` will be used.") : void 0;
1379
1375
  }
1380
1376
  }
1381
1377
  Object.assign(updates, {
1382
- fallbackElement: /*#__PURE__*/React.createElement(route.Fallback),
1383
- Fallback: undefined
1378
+ initialFallbackElement: /*#__PURE__*/React.createElement(route.InitialFallback),
1379
+ InitialFallback: undefined
1384
1380
  });
1385
1381
  }
1386
1382
  if (route.ErrorBoundary) {