@remix-run/router 1.17.1 → 1.18.0
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/CHANGELOG.md +15 -0
- package/dist/index.d.ts +1 -1
- package/dist/router.cjs.js +29 -32
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.d.ts +1 -1
- package/dist/router.js +29 -33
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +29 -32
- 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 +2 -1
- package/index.ts +1 -0
- package/package.json +1 -1
- package/router.ts +32 -30
- package/utils.ts +2 -2
package/dist/router.d.ts
CHANGED
|
@@ -268,7 +268,7 @@ export interface FutureConfig {
|
|
|
268
268
|
v7_partialHydration: boolean;
|
|
269
269
|
v7_prependBasename: boolean;
|
|
270
270
|
v7_relativeSplatPath: boolean;
|
|
271
|
-
|
|
271
|
+
v7_skipActionErrorRevalidation: boolean;
|
|
272
272
|
}
|
|
273
273
|
/**
|
|
274
274
|
* Initialization options for createRouter
|
package/dist/router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.
|
|
2
|
+
* @remix-run/router v1.18.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1344,7 +1344,7 @@ function createRouter(init) {
|
|
|
1344
1344
|
v7_partialHydration: false,
|
|
1345
1345
|
v7_prependBasename: false,
|
|
1346
1346
|
v7_relativeSplatPath: false,
|
|
1347
|
-
|
|
1347
|
+
v7_skipActionErrorRevalidation: false
|
|
1348
1348
|
}, init.future);
|
|
1349
1349
|
// Cleanup function for history
|
|
1350
1350
|
let unlistenHistory = null;
|
|
@@ -1380,10 +1380,13 @@ function createRouter(init) {
|
|
|
1380
1380
|
[route.id]: error
|
|
1381
1381
|
};
|
|
1382
1382
|
}
|
|
1383
|
-
//
|
|
1384
|
-
// match is a splat route, clear them out so we run through lazy
|
|
1385
|
-
// on hydration in case there's a more accurate lazy route match
|
|
1386
|
-
|
|
1383
|
+
// In SPA apps, if the user provided a patchRoutesOnMiss implementation and
|
|
1384
|
+
// our initial match is a splat route, clear them out so we run through lazy
|
|
1385
|
+
// discovery on hydration in case there's a more accurate lazy route match.
|
|
1386
|
+
// In SSR apps (with `hydrationData`), we expect that the server will send
|
|
1387
|
+
// up the proper matched routes so we don't want to run lazy discovery on
|
|
1388
|
+
// initial hydration and want to hydrate into the splat route.
|
|
1389
|
+
if (initialMatches && patchRoutesOnMissImpl && !init.hydrationData) {
|
|
1387
1390
|
let fogOfWar = checkFogOfWar(initialMatches, dataRoutes, init.history.location.pathname);
|
|
1388
1391
|
if (fogOfWar.active) {
|
|
1389
1392
|
initialMatches = null;
|
|
@@ -1998,13 +2001,12 @@ function createRouter(init) {
|
|
|
1998
2001
|
};
|
|
1999
2002
|
} else if (discoverResult.type === "error") {
|
|
2000
2003
|
let {
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
route
|
|
2004
|
+
boundaryId,
|
|
2005
|
+
error
|
|
2004
2006
|
} = handleDiscoverRouteError(location.pathname, discoverResult);
|
|
2005
2007
|
return {
|
|
2006
|
-
matches:
|
|
2007
|
-
pendingActionResult: [
|
|
2008
|
+
matches: discoverResult.partialMatches,
|
|
2009
|
+
pendingActionResult: [boundaryId, {
|
|
2008
2010
|
type: ResultType.error,
|
|
2009
2011
|
error
|
|
2010
2012
|
}]
|
|
@@ -2131,15 +2133,14 @@ function createRouter(init) {
|
|
|
2131
2133
|
};
|
|
2132
2134
|
} else if (discoverResult.type === "error") {
|
|
2133
2135
|
let {
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
route
|
|
2136
|
+
boundaryId,
|
|
2137
|
+
error
|
|
2137
2138
|
} = handleDiscoverRouteError(location.pathname, discoverResult);
|
|
2138
2139
|
return {
|
|
2139
|
-
matches:
|
|
2140
|
+
matches: discoverResult.partialMatches,
|
|
2140
2141
|
loaderData: {},
|
|
2141
2142
|
errors: {
|
|
2142
|
-
[
|
|
2143
|
+
[boundaryId]: error
|
|
2143
2144
|
}
|
|
2144
2145
|
};
|
|
2145
2146
|
} else if (!discoverResult.matches) {
|
|
@@ -2160,7 +2161,7 @@ function createRouter(init) {
|
|
|
2160
2161
|
}
|
|
2161
2162
|
}
|
|
2162
2163
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
2163
|
-
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, future.
|
|
2164
|
+
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult);
|
|
2164
2165
|
// Cancel pending deferreds for no-longer-matched routes or routes we're
|
|
2165
2166
|
// about to reload. Note that if this is an action reload we would have
|
|
2166
2167
|
// already cancelled all pending deferreds so this would be a no-op
|
|
@@ -2479,7 +2480,7 @@ function createRouter(init) {
|
|
|
2479
2480
|
fetchReloadIds.set(key, loadId);
|
|
2480
2481
|
let loadFetcher = getLoadingFetcher(submission, actionResult.data);
|
|
2481
2482
|
state.fetchers.set(key, loadFetcher);
|
|
2482
|
-
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, false, future.
|
|
2483
|
+
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, false, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, [match.route.id, actionResult]);
|
|
2483
2484
|
// Put all revalidating fetchers into the loading state, except for the
|
|
2484
2485
|
// current fetcher which we want to keep in it's current loading state which
|
|
2485
2486
|
// contains it's action submission info + action data
|
|
@@ -2975,18 +2976,13 @@ function createRouter(init) {
|
|
|
2975
2976
|
};
|
|
2976
2977
|
}
|
|
2977
2978
|
function handleDiscoverRouteError(pathname, discoverResult) {
|
|
2978
|
-
let matches = discoverResult.partialMatches;
|
|
2979
|
-
let route = matches[matches.length - 1].route;
|
|
2980
|
-
let error = getInternalRouterError(400, {
|
|
2981
|
-
type: "route-discovery",
|
|
2982
|
-
routeId: route.id,
|
|
2983
|
-
pathname,
|
|
2984
|
-
message: discoverResult.error != null && "message" in discoverResult.error ? discoverResult.error : String(discoverResult.error)
|
|
2985
|
-
});
|
|
2986
2979
|
return {
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2980
|
+
boundaryId: findNearestBoundary(discoverResult.partialMatches).route.id,
|
|
2981
|
+
error: getInternalRouterError(400, {
|
|
2982
|
+
type: "route-discovery",
|
|
2983
|
+
pathname,
|
|
2984
|
+
message: discoverResult.error != null && "message" in discoverResult.error ? discoverResult.error : String(discoverResult.error)
|
|
2985
|
+
})
|
|
2990
2986
|
};
|
|
2991
2987
|
}
|
|
2992
2988
|
function cancelActiveDeferreds(predicate) {
|
|
@@ -3869,7 +3865,7 @@ function getMatchesToLoad(history, state, matches, submission, location, isIniti
|
|
|
3869
3865
|
nextParams: nextRouteMatch.params
|
|
3870
3866
|
}, submission, {
|
|
3871
3867
|
actionResult,
|
|
3872
|
-
|
|
3868
|
+
actionStatus,
|
|
3873
3869
|
defaultShouldRevalidate: shouldSkipRevalidation ? false :
|
|
3874
3870
|
// Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate
|
|
3875
3871
|
isRevalidationRequired || currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search ||
|
|
@@ -3931,7 +3927,7 @@ function getMatchesToLoad(history, state, matches, submission, location, isIniti
|
|
|
3931
3927
|
nextParams: matches[matches.length - 1].params
|
|
3932
3928
|
}, submission, {
|
|
3933
3929
|
actionResult,
|
|
3934
|
-
|
|
3930
|
+
actionStatus,
|
|
3935
3931
|
defaultShouldRevalidate: shouldSkipRevalidation ? false : isRevalidationRequired
|
|
3936
3932
|
}));
|
|
3937
3933
|
}
|
|
@@ -4555,7 +4551,7 @@ function getInternalRouterError(status, _temp5) {
|
|
|
4555
4551
|
if (status === 400) {
|
|
4556
4552
|
statusText = "Bad Request";
|
|
4557
4553
|
if (type === "route-discovery") {
|
|
4558
|
-
errorMessage = "Unable to match URL \"" + pathname + "\" - the `
|
|
4554
|
+
errorMessage = "Unable to match URL \"" + pathname + "\" - the `unstable_patchRoutesOnMiss()` " + ("function threw the following error:\n" + message);
|
|
4559
4555
|
} else if (method && pathname && routeId) {
|
|
4560
4556
|
errorMessage = "You made a " + method + " request to \"" + pathname + "\" but " + ("did not provide a `loader` for route \"" + routeId + "\", ") + "so there is no way to handle the request.";
|
|
4561
4557
|
} else if (type === "defer-action") {
|
|
@@ -4885,5 +4881,5 @@ function persistAppliedTransitions(_window, transitions) {
|
|
|
4885
4881
|
}
|
|
4886
4882
|
//#endregion
|
|
4887
4883
|
|
|
4888
|
-
export { AbortedDeferredError, Action, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, getResolveToMatches as UNSAFE_getResolveToMatches, invariant as UNSAFE_invariant, warning as UNSAFE_warning, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, defer, generatePath, getStaticContextFromError, getToPathname, isDeferredData, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, parsePath, redirect, redirectDocument, resolvePath, resolveTo, stripBasename };
|
|
4884
|
+
export { AbortedDeferredError, Action, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, decodePath as UNSAFE_decodePath, getResolveToMatches as UNSAFE_getResolveToMatches, invariant as UNSAFE_invariant, warning as UNSAFE_warning, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, defer, generatePath, getStaticContextFromError, getToPathname, isDeferredData, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, parsePath, redirect, redirectDocument, resolvePath, resolveTo, stripBasename };
|
|
4889
4885
|
//# sourceMappingURL=router.js.map
|