@remix-run/router 1.22.0-pre-v6.1 → 1.23.0-pre-v6.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 +11 -6
- package/dist/router.cjs.js +20 -19
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +19 -18
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +20 -19
- 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 +1 -0
- package/package.json +1 -1
- package/router.ts +24 -19
- package/utils.ts +1 -0
package/dist/router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.
|
|
2
|
+
* @remix-run/router v1.23.0-pre-v6.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1923,6 +1923,20 @@ function createRouter(init) {
|
|
|
1923
1923
|
// `matchRoutes()` has already been called if we're in here via `router.initialize()`
|
|
1924
1924
|
state.matches : matchRoutes(routesToUse, location, basename);
|
|
1925
1925
|
let flushSync = (opts && opts.flushSync) === true;
|
|
1926
|
+
// Short circuit if it's only a hash change and not a revalidation or
|
|
1927
|
+
// mutation submission.
|
|
1928
|
+
//
|
|
1929
|
+
// Ignore on initial page loads because since the initial hydration will always
|
|
1930
|
+
// be "same hash". For example, on /page#hash and submit a <Form method="post">
|
|
1931
|
+
// which will default to a navigation to /page
|
|
1932
|
+
if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {
|
|
1933
|
+
completeNavigation(location, {
|
|
1934
|
+
matches
|
|
1935
|
+
}, {
|
|
1936
|
+
flushSync
|
|
1937
|
+
});
|
|
1938
|
+
return;
|
|
1939
|
+
}
|
|
1926
1940
|
let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname);
|
|
1927
1941
|
if (fogOfWar.active && fogOfWar.matches) {
|
|
1928
1942
|
matches = fogOfWar.matches;
|
|
@@ -1945,20 +1959,6 @@ function createRouter(init) {
|
|
|
1945
1959
|
});
|
|
1946
1960
|
return;
|
|
1947
1961
|
}
|
|
1948
|
-
// Short circuit if it's only a hash change and not a revalidation or
|
|
1949
|
-
// mutation submission.
|
|
1950
|
-
//
|
|
1951
|
-
// Ignore on initial page loads because since the initial hydration will always
|
|
1952
|
-
// be "same hash". For example, on /page#hash and submit a <Form method="post">
|
|
1953
|
-
// which will default to a navigation to /page
|
|
1954
|
-
if (state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {
|
|
1955
|
-
completeNavigation(location, {
|
|
1956
|
-
matches
|
|
1957
|
-
}, {
|
|
1958
|
-
flushSync
|
|
1959
|
-
});
|
|
1960
|
-
return;
|
|
1961
|
-
}
|
|
1962
1962
|
// Create a controller/Request for this navigation
|
|
1963
1963
|
pendingNavigationController = new AbortController();
|
|
1964
1964
|
let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);
|
|
@@ -2430,7 +2430,7 @@ function createRouter(init) {
|
|
|
2430
2430
|
let abortController = new AbortController();
|
|
2431
2431
|
let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);
|
|
2432
2432
|
if (isFogOfWar) {
|
|
2433
|
-
let discoverResult = await discoverRoutes(requestMatches, new URL(fetchRequest.url).pathname, fetchRequest.signal);
|
|
2433
|
+
let discoverResult = await discoverRoutes(requestMatches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);
|
|
2434
2434
|
if (discoverResult.type === "aborted") {
|
|
2435
2435
|
return;
|
|
2436
2436
|
} else if (discoverResult.type === "error") {
|
|
@@ -2607,7 +2607,7 @@ function createRouter(init) {
|
|
|
2607
2607
|
let abortController = new AbortController();
|
|
2608
2608
|
let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);
|
|
2609
2609
|
if (isFogOfWar) {
|
|
2610
|
-
let discoverResult = await discoverRoutes(matches, new URL(fetchRequest.url).pathname, fetchRequest.signal);
|
|
2610
|
+
let discoverResult = await discoverRoutes(matches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);
|
|
2611
2611
|
if (discoverResult.type === "aborted") {
|
|
2612
2612
|
return;
|
|
2613
2613
|
} else if (discoverResult.type === "error") {
|
|
@@ -3128,7 +3128,7 @@ function createRouter(init) {
|
|
|
3128
3128
|
matches: null
|
|
3129
3129
|
};
|
|
3130
3130
|
}
|
|
3131
|
-
async function discoverRoutes(matches, pathname, signal) {
|
|
3131
|
+
async function discoverRoutes(matches, pathname, signal, fetcherKey) {
|
|
3132
3132
|
if (!patchRoutesOnNavigationImpl) {
|
|
3133
3133
|
return {
|
|
3134
3134
|
type: "success",
|
|
@@ -3145,6 +3145,7 @@ function createRouter(init) {
|
|
|
3145
3145
|
signal,
|
|
3146
3146
|
path: pathname,
|
|
3147
3147
|
matches: partialMatches,
|
|
3148
|
+
fetcherKey,
|
|
3148
3149
|
patch: (routeId, children) => {
|
|
3149
3150
|
if (signal.aborted) return;
|
|
3150
3151
|
patchRoutesImpl(routeId, children, routesToUse, localManifest, mapRouteProperties);
|