react-router 0.0.0-experimental-a25eed86d → 0.0.0-experimental-818f8e08d

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-a25eed86d
2
+ * react-router v0.0.0-experimental-818f8e08d
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -974,57 +974,53 @@ function createRouter(init) {
974
974
  let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);
975
975
  let initialMatchesIsFOW = false;
976
976
  let initialErrors = null;
977
- let initialized;
978
977
  if (initialMatches == null && !init.patchRoutesOnNavigation) {
979
978
  let error = getInternalRouterError(404, {
980
979
  pathname: init.history.location.pathname
981
980
  });
982
981
  let { matches, route } = getShortCircuitMatches(dataRoutes);
983
- initialized = true;
984
982
  initialMatches = matches;
985
983
  initialErrors = { [route.id]: error };
986
- } else {
987
- if (initialMatches && !init.hydrationData) {
988
- let fogOfWar = checkFogOfWar(
989
- initialMatches,
990
- dataRoutes,
991
- init.history.location.pathname
992
- );
993
- if (fogOfWar.active) {
994
- initialMatches = null;
995
- }
984
+ }
985
+ if (initialMatches && !init.hydrationData) {
986
+ let fogOfWar = checkFogOfWar(
987
+ initialMatches,
988
+ dataRoutes,
989
+ init.history.location.pathname
990
+ );
991
+ if (fogOfWar.active) {
992
+ initialMatches = null;
996
993
  }
997
- if (!initialMatches) {
998
- initialized = false;
999
- initialMatches = [];
1000
- let fogOfWar = checkFogOfWar(
1001
- null,
1002
- dataRoutes,
1003
- init.history.location.pathname
994
+ }
995
+ let initialized;
996
+ if (!initialMatches) {
997
+ initialized = false;
998
+ initialMatches = [];
999
+ let fogOfWar = checkFogOfWar(
1000
+ null,
1001
+ dataRoutes,
1002
+ init.history.location.pathname
1003
+ );
1004
+ if (fogOfWar.active && fogOfWar.matches) {
1005
+ initialMatchesIsFOW = true;
1006
+ initialMatches = fogOfWar.matches;
1007
+ }
1008
+ } else if (initialMatches.some((m) => m.route.lazy)) {
1009
+ initialized = false;
1010
+ } else if (!initialMatches.some((m) => m.route.loader)) {
1011
+ initialized = true;
1012
+ } else {
1013
+ let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;
1014
+ let errors = init.hydrationData ? init.hydrationData.errors : null;
1015
+ if (errors) {
1016
+ let idx = initialMatches.findIndex(
1017
+ (m) => errors[m.route.id] !== void 0
1004
1018
  );
1005
- if (fogOfWar.active && fogOfWar.matches) {
1006
- initialMatchesIsFOW = true;
1007
- initialMatches = fogOfWar.matches;
1008
- }
1009
- } else if (initialMatches.some((m) => m.route.lazy)) {
1010
- initialized = false;
1011
- } else if (!initialMatches.some((m) => m.route.loader)) {
1012
- initialized = true;
1019
+ initialized = initialMatches.slice(0, idx + 1).every((m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors));
1013
1020
  } else {
1014
- let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;
1015
- let errors = init.hydrationData ? init.hydrationData.errors : null;
1016
- if (errors) {
1017
- let idx = initialMatches.findIndex(
1018
- (m) => errors[m.route.id] !== void 0
1019
- );
1020
- initialized = initialMatches.slice(0, idx + 1).every(
1021
- (m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors)
1022
- );
1023
- } else {
1024
- initialized = initialMatches.every(
1025
- (m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors)
1026
- );
1027
- }
1021
+ initialized = initialMatches.every(
1022
+ (m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors)
1023
+ );
1028
1024
  }
1029
1025
  }
1030
1026
  let router;
@@ -3579,7 +3575,7 @@ function shouldLoadRouteOnHydration(route, loaderData, errors) {
3579
3575
  if (!route.loader) {
3580
3576
  return false;
3581
3577
  }
3582
- let hasData = loaderData != null && route.id in loaderData;
3578
+ let hasData = loaderData != null && loaderData[route.id] !== void 0;
3583
3579
  let hasError = errors != null && errors[route.id] !== void 0;
3584
3580
  if (!hasData && hasError) {
3585
3581
  return false;
@@ -7969,7 +7965,7 @@ function mergeRefs(...refs) {
7969
7965
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
7970
7966
  try {
7971
7967
  if (isBrowser) {
7972
- window.__reactRouterVersion = "0.0.0-experimental-a25eed86d";
7968
+ window.__reactRouterVersion = "0.0.0-experimental-818f8e08d";
7973
7969
  }
7974
7970
  } catch (e) {
7975
7971
  }
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1 } from './fog-of-war-k8KWkMZc.js';
3
- import { R as RouterInit } from './route-data-BvrN3Sw4.js';
2
+ import { RouterProviderProps as RouterProviderProps$1, RouterInit } from 'react-router';
4
3
 
5
4
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
6
5
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;