@remix-run/router 0.0.0-experimental-ce5294fc → 0.0.0-experimental-35fa15e5
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/router.cjs.js +14 -13
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +14 -13
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +14 -13
- package/dist/router.umd.js.map +1 -1
- package/dist/router.umd.min.js +2 -2
- package/dist/router.umd.min.js.map +1 -1
- package/dist/utils.d.ts +4 -2
- package/package.json +1 -1
- package/router.ts +9 -18
- package/utils.ts +2 -2
package/dist/router.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v0.0.0-experimental-
|
|
2
|
+
* @remix-run/router v0.0.0-experimental-35fa15e5
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2258,7 +2258,7 @@ function createRouter(init) {
|
|
|
2258
2258
|
|
|
2259
2259
|
// Create a controller/Request for this navigation
|
|
2260
2260
|
pendingNavigationController = new AbortController();
|
|
2261
|
-
let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.
|
|
2261
|
+
let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);
|
|
2262
2262
|
let pendingActionData;
|
|
2263
2263
|
let pendingError;
|
|
2264
2264
|
if (opts && opts.pendingError) {
|
|
@@ -2614,7 +2614,7 @@ function createRouter(init) {
|
|
|
2614
2614
|
|
|
2615
2615
|
// Call the action for the fetcher
|
|
2616
2616
|
let abortController = new AbortController();
|
|
2617
|
-
let fetchRequest = createClientSideRequest(init.history, path, abortController.signal,
|
|
2617
|
+
let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);
|
|
2618
2618
|
fetchControllers.set(key, abortController);
|
|
2619
2619
|
let originatingLoadId = incrementingLoadId;
|
|
2620
2620
|
let actionResult = await callLoaderOrAction("action", fetchRequest, match, requestMatches, manifest, mapRouteProperties, basename);
|
|
@@ -2662,7 +2662,7 @@ function createRouter(init) {
|
|
|
2662
2662
|
// Start the data load for current matches, or the next location if we're
|
|
2663
2663
|
// in the middle of a navigation
|
|
2664
2664
|
let nextLocation = state.navigation.location || state.location;
|
|
2665
|
-
let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal
|
|
2665
|
+
let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal);
|
|
2666
2666
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
2667
2667
|
let matches = state.navigation.state !== "idle" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches;
|
|
2668
2668
|
invariant(matches, "Didn't find any matches after fetcher action");
|
|
@@ -2767,7 +2767,7 @@ function createRouter(init) {
|
|
|
2767
2767
|
|
|
2768
2768
|
// Call the loader for this fetcher route match
|
|
2769
2769
|
let abortController = new AbortController();
|
|
2770
|
-
let fetchRequest = createClientSideRequest(init.history, path, abortController.signal
|
|
2770
|
+
let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);
|
|
2771
2771
|
fetchControllers.set(key, abortController);
|
|
2772
2772
|
let originatingLoadId = incrementingLoadId;
|
|
2773
2773
|
let result = await callLoaderOrAction("loader", fetchRequest, match, matches, manifest, mapRouteProperties, basename);
|
|
@@ -2920,7 +2920,7 @@ function createRouter(init) {
|
|
|
2920
2920
|
// accordingly
|
|
2921
2921
|
let results = await Promise.all([...matchesToLoad.map(match => callLoaderOrAction("loader", request, match, matches, manifest, mapRouteProperties, basename)), ...fetchersToLoad.map(f => {
|
|
2922
2922
|
if (f.matches && f.match && f.controller) {
|
|
2923
|
-
return callLoaderOrAction("loader", createClientSideRequest(init.history, f.path, f.controller.signal
|
|
2923
|
+
return callLoaderOrAction("loader", createClientSideRequest(init.history, f.path, f.controller.signal), f.match, f.matches, manifest, mapRouteProperties, basename);
|
|
2924
2924
|
} else {
|
|
2925
2925
|
let error = {
|
|
2926
2926
|
type: ResultType.error,
|
|
@@ -3954,7 +3954,13 @@ function getMatchesToLoad(history, state, matches, submission, location, isIniti
|
|
|
3954
3954
|
// Is this route unhydrated (when v7_partialHydration=true) such that we need
|
|
3955
3955
|
// to call it's loader on the initial router creation
|
|
3956
3956
|
function isUnhydratedRoute(state, route) {
|
|
3957
|
-
|
|
3957
|
+
if (!route.loader) {
|
|
3958
|
+
return false;
|
|
3959
|
+
}
|
|
3960
|
+
if (route.loader.hydrate) {
|
|
3961
|
+
return true;
|
|
3962
|
+
}
|
|
3963
|
+
return state.loaderData[route.id] === undefined && (!state.errors ||
|
|
3958
3964
|
// Loader ran but errored - don't re-run
|
|
3959
3965
|
state.errors[route.id] === undefined);
|
|
3960
3966
|
}
|
|
@@ -4221,16 +4227,11 @@ async function callLoaderOrAction(type, request, match, matches, manifest, mapRo
|
|
|
4221
4227
|
// Utility method for creating the Request instances for loaders/actions during
|
|
4222
4228
|
// client-side navigations and fetches. During SSR we will always have a
|
|
4223
4229
|
// Request instance from the static handler (query/queryRoute)
|
|
4224
|
-
function createClientSideRequest(history, location, signal,
|
|
4230
|
+
function createClientSideRequest(history, location, signal, submission) {
|
|
4225
4231
|
let url = history.createURL(stripHashFromPath(location)).toString();
|
|
4226
4232
|
let init = {
|
|
4227
4233
|
signal
|
|
4228
4234
|
};
|
|
4229
|
-
if (initial) {
|
|
4230
|
-
init.headers = {
|
|
4231
|
-
"X-Remix-Initial-Load": "yes"
|
|
4232
|
-
};
|
|
4233
|
-
}
|
|
4234
4235
|
if (submission && isMutationMethod(submission.formMethod)) {
|
|
4235
4236
|
let {
|
|
4236
4237
|
formMethod,
|