@remix-run/router 1.12.0 → 1.13.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 +13 -0
- package/dist/index.d.ts +2 -2
- package/dist/router.cjs.js +14 -7
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +13 -7
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +14 -7
- 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 +2 -1
- package/package.json +1 -1
- package/router.ts +9 -2
- package/utils.ts +12 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# `@remix-run/router`
|
|
2
2
|
|
|
3
|
+
## 1.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Export the `PathParam` type from the public API ([#10719](https://github.com/remix-run/react-router/pull/10719))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Fix bug with `resolveTo` in splat routes ([#11045](https://github.com/remix-run/react-router/pull/11045))
|
|
12
|
+
- This is a follow up to [#10983](https://github.com/remix-run/react-router/pull/10983) to handle the few other code paths using `getPathContributingMatches`
|
|
13
|
+
- This removes the `UNSAFE_getPathContributingMatches` export from `@remix-run/router` since we no longer need this in the `react-router`/`react-router-dom` layers
|
|
14
|
+
- Do not revalidate unmounted fetchers when `v7_fetcherPersist` is enabled ([#11044](https://github.com/remix-run/react-router/pull/11044))
|
|
15
|
+
|
|
3
16
|
## 1.12.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, ErrorResponse, FormEncType, FormMethod, HTMLFormMethod, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, TrackedPromise, UIMatch, V7_FormMethod, } from "./utils";
|
|
1
|
+
export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, ErrorResponse, FormEncType, FormMethod, HTMLFormMethod, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, TrackedPromise, UIMatch, V7_FormMethod, } from "./utils";
|
|
2
2
|
export { AbortedDeferredError, defer, generatePath, getToPathname, 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";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export type { RouteManifest as UNSAFE_RouteManifest } from "./utils";
|
|
8
|
-
export { DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch,
|
|
8
|
+
export { DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, getResolveToMatches as UNSAFE_getResolveToMatches, } from "./utils";
|
|
9
9
|
export { invariant as UNSAFE_invariant, warning as UNSAFE_warning, } from "./history";
|
package/dist/router.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.
|
|
2
|
+
* @remix-run/router v1.13.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1192,6 +1192,13 @@ function getPathContributingMatches(matches) {
|
|
|
1192
1192
|
return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);
|
|
1193
1193
|
}
|
|
1194
1194
|
|
|
1195
|
+
// Return the array of pathnames for the current route matches - used to
|
|
1196
|
+
// generate the routePathnames input for resolveTo()
|
|
1197
|
+
function getResolveToMatches(matches) {
|
|
1198
|
+
// Use the full pathname for the leaf match so we include splat values for "." links
|
|
1199
|
+
return getPathContributingMatches(matches).map((match, idx) => idx === matches.length - 1 ? match.pathname : match.pathnameBase);
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1195
1202
|
/**
|
|
1196
1203
|
* @private
|
|
1197
1204
|
*/
|
|
@@ -2393,7 +2400,7 @@ function createRouter(init) {
|
|
|
2393
2400
|
// we have it on the loading navigation so use that if available
|
|
2394
2401
|
let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);
|
|
2395
2402
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
2396
|
-
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionData, pendingError);
|
|
2403
|
+
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionData, pendingError);
|
|
2397
2404
|
|
|
2398
2405
|
// Cancel pending deferreds for no-longer-matched routes or routes we're
|
|
2399
2406
|
// about to reload. Note that if this is an action reload we would have
|
|
@@ -2652,7 +2659,7 @@ function createRouter(init) {
|
|
|
2652
2659
|
fetchReloadIds.set(key, loadId);
|
|
2653
2660
|
let loadFetcher = getLoadingFetcher(submission, actionResult.data);
|
|
2654
2661
|
state.fetchers.set(key, loadFetcher);
|
|
2655
|
-
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, {
|
|
2662
|
+
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, {
|
|
2656
2663
|
[match.route.id]: actionResult.data
|
|
2657
2664
|
}, undefined // No need to send through errors since we short circuit above
|
|
2658
2665
|
);
|
|
@@ -3643,7 +3650,7 @@ function normalizeTo(location, matches, basename, prependBasename, to, fromRoute
|
|
|
3643
3650
|
}
|
|
3644
3651
|
|
|
3645
3652
|
// Resolve the relative path
|
|
3646
|
-
let path = resolveTo(to ? to : ".",
|
|
3653
|
+
let path = resolveTo(to ? to : ".", getResolveToMatches(contextualMatches), stripBasename(location.pathname, basename) || location.pathname, relative === "path");
|
|
3647
3654
|
|
|
3648
3655
|
// When `to` is not specified we inherit search/hash from the current
|
|
3649
3656
|
// location, unlike when to="." and we just inherit the path.
|
|
@@ -3807,7 +3814,7 @@ function getLoaderMatchesUntilBoundary(matches, boundaryId) {
|
|
|
3807
3814
|
}
|
|
3808
3815
|
return boundaryMatches;
|
|
3809
3816
|
}
|
|
3810
|
-
function getMatchesToLoad(history, state, matches, submission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionData, pendingError) {
|
|
3817
|
+
function getMatchesToLoad(history, state, matches, submission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionData, pendingError) {
|
|
3811
3818
|
let actionResult = pendingError ? Object.values(pendingError)[0] : pendingActionData ? Object.values(pendingActionData)[0] : undefined;
|
|
3812
3819
|
let currentUrl = history.createURL(state.location);
|
|
3813
3820
|
let nextUrl = history.createURL(location);
|
|
@@ -3856,7 +3863,7 @@ function getMatchesToLoad(history, state, matches, submission, location, isReval
|
|
|
3856
3863
|
let revalidatingFetchers = [];
|
|
3857
3864
|
fetchLoadMatches.forEach((f, key) => {
|
|
3858
3865
|
// Don't revalidate if fetcher won't be present in the subsequent render
|
|
3859
|
-
if (!matches.some(m => m.route.id === f.routeId)) {
|
|
3866
|
+
if (!matches.some(m => m.route.id === f.routeId) || deletedFetchers.has(key)) {
|
|
3860
3867
|
return;
|
|
3861
3868
|
}
|
|
3862
3869
|
let fetcherMatches = matchRoutes(routesToUse, f.path, basename);
|
|
@@ -4742,7 +4749,7 @@ exports.UNSAFE_DeferredData = DeferredData;
|
|
|
4742
4749
|
exports.UNSAFE_ErrorResponseImpl = ErrorResponseImpl;
|
|
4743
4750
|
exports.UNSAFE_convertRouteMatchToUiMatch = convertRouteMatchToUiMatch;
|
|
4744
4751
|
exports.UNSAFE_convertRoutesToDataRoutes = convertRoutesToDataRoutes;
|
|
4745
|
-
exports.
|
|
4752
|
+
exports.UNSAFE_getResolveToMatches = getResolveToMatches;
|
|
4746
4753
|
exports.UNSAFE_invariant = invariant;
|
|
4747
4754
|
exports.UNSAFE_warning = warning;
|
|
4748
4755
|
exports.createBrowserHistory = createBrowserHistory;
|