@remix-run/router 0.0.0-experimental-cbcd94b7 → 0.0.0-experimental-0141b5ec
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 +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/router.cjs.js +30 -18
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.d.ts +1 -1
- package/dist/router.js +28 -18
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +30 -18
- 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/index.ts +2 -1
- package/package.json +1 -1
- package/router.ts +21 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# `@remix-run/router`
|
|
2
2
|
|
|
3
|
+
## 1.15.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Preserve hydrated errors during partial hydration runs ([#11305](https://github.com/remix-run/react-router/pull/11305))
|
|
8
|
+
|
|
9
|
+
## 1.15.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Fix encoding/decoding issues with pre-encoded dynamic parameter values ([#11199](https://github.com/remix-run/react-router/pull/11199))
|
|
14
|
+
|
|
3
15
|
## 1.15.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, ErrorResponse, FormEncType, FormMethod, HTMLFormMethod, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, TrackedPromise, UIMatch, V7_FormMethod, } from "./utils";
|
|
2
|
-
export { AbortedDeferredError, DecodedResponse, defer, generatePath, getToPathname, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, redirect, redirectDocument, resolvePath, resolveTo, stripBasename, } from "./utils";
|
|
2
|
+
export { AbortedDeferredError, DecodedResponse as unstable_DecodedResponse, defer, generatePath, getToPathname, isDecodedResponse as unstable_isDecodedResponse, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, redirect, redirectDocument, resolvePath, resolveTo, stripBasename, } from "./utils";
|
|
3
3
|
export type { BrowserHistory, BrowserHistoryOptions, HashHistory, HashHistoryOptions, History, InitialEntry, Location, MemoryHistory, MemoryHistoryOptions, Path, To, } from "./history";
|
|
4
4
|
export { Action, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, parsePath, } from "./history";
|
|
5
5
|
export * from "./router";
|
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-0141b5ec
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1699,7 +1699,7 @@ function createRouter(init) {
|
|
|
1699
1699
|
v7_partialHydration: false,
|
|
1700
1700
|
v7_prependBasename: false,
|
|
1701
1701
|
v7_relativeSplatPath: false,
|
|
1702
|
-
|
|
1702
|
+
unstable_skipActionErrorRevalidation: true
|
|
1703
1703
|
}, init.future);
|
|
1704
1704
|
// Cleanup function for history
|
|
1705
1705
|
let unlistenHistory = null;
|
|
@@ -2421,7 +2421,7 @@ function createRouter(init) {
|
|
|
2421
2421
|
// we have it on the loading navigation so use that if available
|
|
2422
2422
|
let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);
|
|
2423
2423
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
2424
|
-
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, future.
|
|
2424
|
+
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, future.unstable_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult);
|
|
2425
2425
|
|
|
2426
2426
|
// Cancel pending deferreds for no-longer-matched routes or routes we're
|
|
2427
2427
|
// about to reload. Note that if this is an action reload we would have
|
|
@@ -2454,7 +2454,7 @@ function createRouter(init) {
|
|
|
2454
2454
|
// preserving any new action data or existing action data (in the case of
|
|
2455
2455
|
// a revalidation interrupting an actionReload)
|
|
2456
2456
|
// If we have partialHydration enabled, then don't update the state for the
|
|
2457
|
-
// initial data load since
|
|
2457
|
+
// initial data load since it's not a "navigation"
|
|
2458
2458
|
if (!isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration)) {
|
|
2459
2459
|
revalidatingFetchers.forEach(rf => {
|
|
2460
2460
|
let fetcher = state.fetchers.get(rf.key);
|
|
@@ -2556,6 +2556,19 @@ function createRouter(init) {
|
|
|
2556
2556
|
}
|
|
2557
2557
|
});
|
|
2558
2558
|
});
|
|
2559
|
+
|
|
2560
|
+
// During partial hydration, preserve SSR errors for routes that don't re-run
|
|
2561
|
+
if (future.v7_partialHydration && initialHydration && state.errors) {
|
|
2562
|
+
Object.entries(state.errors).filter(_ref2 => {
|
|
2563
|
+
let [id] = _ref2;
|
|
2564
|
+
return !matchesToLoad.some(m => m.route.id === id);
|
|
2565
|
+
}).forEach(_ref3 => {
|
|
2566
|
+
let [routeId, error] = _ref3;
|
|
2567
|
+
errors = Object.assign(errors || {}, {
|
|
2568
|
+
[routeId]: error
|
|
2569
|
+
});
|
|
2570
|
+
});
|
|
2571
|
+
}
|
|
2559
2572
|
let updatedFetchers = markFetchRedirectsDone();
|
|
2560
2573
|
let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);
|
|
2561
2574
|
let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;
|
|
@@ -2702,7 +2715,7 @@ function createRouter(init) {
|
|
|
2702
2715
|
fetchReloadIds.set(key, loadId);
|
|
2703
2716
|
let loadFetcher = getLoadingFetcher(submission, actionResult.data);
|
|
2704
2717
|
state.fetchers.set(key, loadFetcher);
|
|
2705
|
-
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, false, future.
|
|
2718
|
+
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, false, future.unstable_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, [match.route.id, actionResult]);
|
|
2706
2719
|
|
|
2707
2720
|
// Put all revalidating fetchers into the loading state, except for the
|
|
2708
2721
|
// current fetcher which we want to keep in it's current loading state which
|
|
@@ -3156,12 +3169,12 @@ function createRouter(init) {
|
|
|
3156
3169
|
blockers
|
|
3157
3170
|
});
|
|
3158
3171
|
}
|
|
3159
|
-
function shouldBlockNavigation(
|
|
3172
|
+
function shouldBlockNavigation(_ref4) {
|
|
3160
3173
|
let {
|
|
3161
3174
|
currentLocation,
|
|
3162
3175
|
nextLocation,
|
|
3163
3176
|
historyAction
|
|
3164
|
-
} =
|
|
3177
|
+
} = _ref4;
|
|
3165
3178
|
if (blockerFunctions.size === 0) {
|
|
3166
3179
|
return;
|
|
3167
3180
|
}
|
|
@@ -3708,9 +3721,8 @@ function createStaticHandler(routes, opts) {
|
|
|
3708
3721
|
throw normalizeRelativeRoutingRedirectResponse(result.result, request, matchesToLoad[i].route.id, matches, basename, future.v7_relativeSplatPath);
|
|
3709
3722
|
}
|
|
3710
3723
|
if (isResponse(result.result) && isRouteRequest) {
|
|
3711
|
-
// For SSR single-route requests, we want to hand Responses back
|
|
3712
|
-
// without unwrapping
|
|
3713
|
-
// interface so we can know whether it was returned or thrown
|
|
3724
|
+
// For SSR single-route requests, we want to hand Responses back
|
|
3725
|
+
// directly without unwrapping
|
|
3714
3726
|
throw result;
|
|
3715
3727
|
}
|
|
3716
3728
|
return convertHandlerResultToDataResult(result);
|
|
@@ -3833,8 +3845,8 @@ function normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) {
|
|
|
3833
3845
|
}
|
|
3834
3846
|
let text = typeof opts.body === "string" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ?
|
|
3835
3847
|
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data
|
|
3836
|
-
Array.from(opts.body.entries()).reduce((acc,
|
|
3837
|
-
let [name, value] =
|
|
3848
|
+
Array.from(opts.body.entries()).reduce((acc, _ref5) => {
|
|
3849
|
+
let [name, value] = _ref5;
|
|
3838
3850
|
return "" + acc + name + "=" + value + "\n";
|
|
3839
3851
|
}, "") : String(opts.body);
|
|
3840
3852
|
return {
|
|
@@ -4108,7 +4120,7 @@ function shouldRevalidateLoader(loaderMatch, arg) {
|
|
|
4108
4120
|
*/
|
|
4109
4121
|
async function loadLazyRouteModule(route, mapRouteProperties, manifest) {
|
|
4110
4122
|
if (!route.lazy) {
|
|
4111
|
-
return
|
|
4123
|
+
return;
|
|
4112
4124
|
}
|
|
4113
4125
|
let lazyRoute = await route.lazy();
|
|
4114
4126
|
|
|
@@ -4116,7 +4128,7 @@ async function loadLazyRouteModule(route, mapRouteProperties, manifest) {
|
|
|
4116
4128
|
// call then we can return - first lazy() to finish wins because the return
|
|
4117
4129
|
// value of lazy is expected to be static
|
|
4118
4130
|
if (!route.lazy) {
|
|
4119
|
-
return
|
|
4131
|
+
return;
|
|
4120
4132
|
}
|
|
4121
4133
|
let routeToUpdate = manifest[route.id];
|
|
4122
4134
|
invariant(routeToUpdate, "No route found in manifest");
|
|
@@ -4152,7 +4164,6 @@ async function loadLazyRouteModule(route, mapRouteProperties, manifest) {
|
|
|
4152
4164
|
Object.assign(routeToUpdate, _extends({}, mapRouteProperties(routeToUpdate), {
|
|
4153
4165
|
lazy: undefined
|
|
4154
4166
|
}));
|
|
4155
|
-
return routeToUpdate;
|
|
4156
4167
|
}
|
|
4157
4168
|
|
|
4158
4169
|
// Default implementation of `dataStrategy` which fetches all loaders in parallel
|
|
@@ -4234,7 +4245,7 @@ async function callLoaderOrAction(type, request, match, manifest, mapRouteProper
|
|
|
4234
4245
|
if (handler) {
|
|
4235
4246
|
// Run statically defined handler in parallel with lazy()
|
|
4236
4247
|
let handlerError;
|
|
4237
|
-
let
|
|
4248
|
+
let [value] = await Promise.all([
|
|
4238
4249
|
// If the handler throws, don't let it immediately bubble out,
|
|
4239
4250
|
// since we need to let the lazy() execution finish so we know if this
|
|
4240
4251
|
// route has a boundary that can handle the error
|
|
@@ -4244,7 +4255,7 @@ async function callLoaderOrAction(type, request, match, manifest, mapRouteProper
|
|
|
4244
4255
|
if (handlerError !== undefined) {
|
|
4245
4256
|
throw handlerError;
|
|
4246
4257
|
}
|
|
4247
|
-
result =
|
|
4258
|
+
result = value;
|
|
4248
4259
|
} else {
|
|
4249
4260
|
// Load lazy route module, then run any returned handler
|
|
4250
4261
|
await loadLazyRouteModule(match.route, mapRouteProperties, manifest);
|
|
@@ -4967,7 +4978,6 @@ function persistAppliedTransitions(_window, transitions) {
|
|
|
4967
4978
|
|
|
4968
4979
|
exports.AbortedDeferredError = AbortedDeferredError;
|
|
4969
4980
|
exports.Action = Action;
|
|
4970
|
-
exports.DecodedResponse = DecodedResponse;
|
|
4971
4981
|
exports.IDLE_BLOCKER = IDLE_BLOCKER;
|
|
4972
4982
|
exports.IDLE_FETCHER = IDLE_FETCHER;
|
|
4973
4983
|
exports.IDLE_NAVIGATION = IDLE_NAVIGATION;
|
|
@@ -5002,4 +5012,6 @@ exports.redirectDocument = redirectDocument;
|
|
|
5002
5012
|
exports.resolvePath = resolvePath;
|
|
5003
5013
|
exports.resolveTo = resolveTo;
|
|
5004
5014
|
exports.stripBasename = stripBasename;
|
|
5015
|
+
exports.unstable_DecodedResponse = DecodedResponse;
|
|
5016
|
+
exports.unstable_isDecodedResponse = isDecodedResponse;
|
|
5005
5017
|
//# sourceMappingURL=router.cjs.js.map
|