@remix-run/router 1.12.0-pre.0 → 1.13.0-pre.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 +16 -1
- 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/dist/router.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.
|
|
2
|
+
* @remix-run/router v1.13.0-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1194,6 +1194,13 @@
|
|
|
1194
1194
|
return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);
|
|
1195
1195
|
}
|
|
1196
1196
|
|
|
1197
|
+
// Return the array of pathnames for the current route matches - used to
|
|
1198
|
+
// generate the routePathnames input for resolveTo()
|
|
1199
|
+
function getResolveToMatches(matches) {
|
|
1200
|
+
// Use the full pathname for the leaf match so we include splat values for "." links
|
|
1201
|
+
return getPathContributingMatches(matches).map((match, idx) => idx === matches.length - 1 ? match.pathname : match.pathnameBase);
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1197
1204
|
/**
|
|
1198
1205
|
* @private
|
|
1199
1206
|
*/
|
|
@@ -2395,7 +2402,7 @@
|
|
|
2395
2402
|
// we have it on the loading navigation so use that if available
|
|
2396
2403
|
let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);
|
|
2397
2404
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
2398
|
-
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionData, pendingError);
|
|
2405
|
+
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionData, pendingError);
|
|
2399
2406
|
|
|
2400
2407
|
// Cancel pending deferreds for no-longer-matched routes or routes we're
|
|
2401
2408
|
// about to reload. Note that if this is an action reload we would have
|
|
@@ -2654,7 +2661,7 @@
|
|
|
2654
2661
|
fetchReloadIds.set(key, loadId);
|
|
2655
2662
|
let loadFetcher = getLoadingFetcher(submission, actionResult.data);
|
|
2656
2663
|
state.fetchers.set(key, loadFetcher);
|
|
2657
|
-
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, {
|
|
2664
|
+
let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, {
|
|
2658
2665
|
[match.route.id]: actionResult.data
|
|
2659
2666
|
}, undefined // No need to send through errors since we short circuit above
|
|
2660
2667
|
);
|
|
@@ -3645,7 +3652,7 @@
|
|
|
3645
3652
|
}
|
|
3646
3653
|
|
|
3647
3654
|
// Resolve the relative path
|
|
3648
|
-
let path = resolveTo(to ? to : ".",
|
|
3655
|
+
let path = resolveTo(to ? to : ".", getResolveToMatches(contextualMatches), stripBasename(location.pathname, basename) || location.pathname, relative === "path");
|
|
3649
3656
|
|
|
3650
3657
|
// When `to` is not specified we inherit search/hash from the current
|
|
3651
3658
|
// location, unlike when to="." and we just inherit the path.
|
|
@@ -3809,7 +3816,7 @@
|
|
|
3809
3816
|
}
|
|
3810
3817
|
return boundaryMatches;
|
|
3811
3818
|
}
|
|
3812
|
-
function getMatchesToLoad(history, state, matches, submission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionData, pendingError) {
|
|
3819
|
+
function getMatchesToLoad(history, state, matches, submission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionData, pendingError) {
|
|
3813
3820
|
let actionResult = pendingError ? Object.values(pendingError)[0] : pendingActionData ? Object.values(pendingActionData)[0] : undefined;
|
|
3814
3821
|
let currentUrl = history.createURL(state.location);
|
|
3815
3822
|
let nextUrl = history.createURL(location);
|
|
@@ -3858,7 +3865,7 @@
|
|
|
3858
3865
|
let revalidatingFetchers = [];
|
|
3859
3866
|
fetchLoadMatches.forEach((f, key) => {
|
|
3860
3867
|
// Don't revalidate if fetcher won't be present in the subsequent render
|
|
3861
|
-
if (!matches.some(m => m.route.id === f.routeId)) {
|
|
3868
|
+
if (!matches.some(m => m.route.id === f.routeId) || deletedFetchers.has(key)) {
|
|
3862
3869
|
return;
|
|
3863
3870
|
}
|
|
3864
3871
|
let fetcherMatches = matchRoutes(routesToUse, f.path, basename);
|
|
@@ -4744,7 +4751,7 @@
|
|
|
4744
4751
|
exports.UNSAFE_ErrorResponseImpl = ErrorResponseImpl;
|
|
4745
4752
|
exports.UNSAFE_convertRouteMatchToUiMatch = convertRouteMatchToUiMatch;
|
|
4746
4753
|
exports.UNSAFE_convertRoutesToDataRoutes = convertRoutesToDataRoutes;
|
|
4747
|
-
exports.
|
|
4754
|
+
exports.UNSAFE_getResolveToMatches = getResolveToMatches;
|
|
4748
4755
|
exports.UNSAFE_invariant = invariant;
|
|
4749
4756
|
exports.UNSAFE_warning = warning;
|
|
4750
4757
|
exports.createBrowserHistory = createBrowserHistory;
|