react-router 0.0.0-experimental-b2bc694a6 → 0.0.0-experimental-a25eed86d
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/development/{chunk-YFJEQYI5.mjs → chunk-JS5R3RPS.mjs} +44 -40
- package/dist/development/dom-export.d.ts +2 -1
- package/dist/development/dom-export.js +6123 -31
- package/dist/development/dom-export.mjs +2 -2
- package/dist/development/fog-of-war-k8KWkMZc.d.ts +1746 -0
- package/dist/development/index.d.ts +186 -1926
- package/dist/development/index.js +44 -40
- package/dist/development/index.mjs +2 -2
- package/dist/development/lib/types/route-module.d.ts +1 -1
- package/dist/development/lib/types/route-module.js +1 -1
- package/dist/development/lib/types/route-module.mjs +1 -1
- package/dist/development/{route-data-fNWkI-4T.d.ts → route-data-BvrN3Sw4.d.ts} +1 -1
- package/dist/production/{chunk-257QFYRX.mjs → chunk-N6ZF3R6Q.mjs} +44 -40
- package/dist/production/dom-export.d.ts +2 -1
- package/dist/production/dom-export.js +6123 -31
- package/dist/production/dom-export.mjs +2 -2
- package/dist/production/fog-of-war-k8KWkMZc.d.ts +1746 -0
- package/dist/production/index.d.ts +186 -1926
- package/dist/production/index.js +44 -40
- package/dist/production/index.mjs +2 -2
- package/dist/production/lib/types/route-module.d.ts +1 -1
- package/dist/production/lib/types/route-module.js +1 -1
- package/dist/production/lib/types/route-module.mjs +1 -1
- package/dist/production/{route-data-fNWkI-4T.d.ts → route-data-BvrN3Sw4.d.ts} +1 -1
- package/package.json +4 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-a25eed86d
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -974,53 +974,57 @@ 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;
|
|
977
978
|
if (initialMatches == null && !init.patchRoutesOnNavigation) {
|
|
978
979
|
let error = getInternalRouterError(404, {
|
|
979
980
|
pathname: init.history.location.pathname
|
|
980
981
|
});
|
|
981
982
|
let { matches, route } = getShortCircuitMatches(dataRoutes);
|
|
983
|
+
initialized = true;
|
|
982
984
|
initialMatches = matches;
|
|
983
985
|
initialErrors = { [route.id]: error };
|
|
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;
|
|
993
|
-
}
|
|
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
986
|
} else {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
987
|
+
if (initialMatches && !init.hydrationData) {
|
|
988
|
+
let fogOfWar = checkFogOfWar(
|
|
989
|
+
initialMatches,
|
|
990
|
+
dataRoutes,
|
|
991
|
+
init.history.location.pathname
|
|
1018
992
|
);
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
993
|
+
if (fogOfWar.active) {
|
|
994
|
+
initialMatches = null;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
if (!initialMatches) {
|
|
998
|
+
initialized = false;
|
|
999
|
+
initialMatches = [];
|
|
1000
|
+
let fogOfWar = checkFogOfWar(
|
|
1001
|
+
null,
|
|
1002
|
+
dataRoutes,
|
|
1003
|
+
init.history.location.pathname
|
|
1023
1004
|
);
|
|
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;
|
|
1013
|
+
} 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
|
+
}
|
|
1024
1028
|
}
|
|
1025
1029
|
}
|
|
1026
1030
|
let router;
|
|
@@ -3575,7 +3579,7 @@ function shouldLoadRouteOnHydration(route, loaderData, errors) {
|
|
|
3575
3579
|
if (!route.loader) {
|
|
3576
3580
|
return false;
|
|
3577
3581
|
}
|
|
3578
|
-
let hasData = loaderData != null &&
|
|
3582
|
+
let hasData = loaderData != null && route.id in loaderData;
|
|
3579
3583
|
let hasError = errors != null && errors[route.id] !== void 0;
|
|
3580
3584
|
if (!hasData && hasError) {
|
|
3581
3585
|
return false;
|
|
@@ -7965,7 +7969,7 @@ function mergeRefs(...refs) {
|
|
|
7965
7969
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
7966
7970
|
try {
|
|
7967
7971
|
if (isBrowser) {
|
|
7968
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
7972
|
+
window.__reactRouterVersion = "0.0.0-experimental-a25eed86d";
|
|
7969
7973
|
}
|
|
7970
7974
|
} catch (e) {
|
|
7971
7975
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-k8KWkMZc.js';
|
|
3
|
+
import { R as RouterInit } from './route-data-BvrN3Sw4.js';
|
|
3
4
|
|
|
4
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
5
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|