@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/utils.d.ts
CHANGED
|
@@ -204,6 +204,7 @@ export type AgnosticPatchRoutesOnNavigationFunctionArgs<O extends AgnosticRouteO
|
|
|
204
204
|
signal: AbortSignal;
|
|
205
205
|
path: string;
|
|
206
206
|
matches: M[];
|
|
207
|
+
fetcherKey: string | undefined;
|
|
207
208
|
patch: (routeId: string | null, children: O[]) => void;
|
|
208
209
|
};
|
|
209
210
|
export type AgnosticPatchRoutesOnNavigationFunction<O extends AgnosticRouteObject = AgnosticRouteObject, M extends AgnosticRouteMatch = AgnosticRouteMatch> = (opts: AgnosticPatchRoutesOnNavigationFunctionArgs<O, M>) => void | Promise<void>;
|
package/package.json
CHANGED
package/router.ts
CHANGED
|
@@ -1534,6 +1534,23 @@ export function createRouter(init: RouterInit): Router {
|
|
|
1534
1534
|
: matchRoutes(routesToUse, location, basename);
|
|
1535
1535
|
let flushSync = (opts && opts.flushSync) === true;
|
|
1536
1536
|
|
|
1537
|
+
// Short circuit if it's only a hash change and not a revalidation or
|
|
1538
|
+
// mutation submission.
|
|
1539
|
+
//
|
|
1540
|
+
// Ignore on initial page loads because since the initial hydration will always
|
|
1541
|
+
// be "same hash". For example, on /page#hash and submit a <Form method="post">
|
|
1542
|
+
// which will default to a navigation to /page
|
|
1543
|
+
if (
|
|
1544
|
+
matches &&
|
|
1545
|
+
state.initialized &&
|
|
1546
|
+
!isRevalidationRequired &&
|
|
1547
|
+
isHashChangeOnly(state.location, location) &&
|
|
1548
|
+
!(opts && opts.submission && isMutationMethod(opts.submission.formMethod))
|
|
1549
|
+
) {
|
|
1550
|
+
completeNavigation(location, { matches }, { flushSync });
|
|
1551
|
+
return;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1537
1554
|
let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname);
|
|
1538
1555
|
if (fogOfWar.active && fogOfWar.matches) {
|
|
1539
1556
|
matches = fogOfWar.matches;
|
|
@@ -1558,22 +1575,6 @@ export function createRouter(init: RouterInit): Router {
|
|
|
1558
1575
|
return;
|
|
1559
1576
|
}
|
|
1560
1577
|
|
|
1561
|
-
// Short circuit if it's only a hash change and not a revalidation or
|
|
1562
|
-
// mutation submission.
|
|
1563
|
-
//
|
|
1564
|
-
// Ignore on initial page loads because since the initial hydration will always
|
|
1565
|
-
// be "same hash". For example, on /page#hash and submit a <Form method="post">
|
|
1566
|
-
// which will default to a navigation to /page
|
|
1567
|
-
if (
|
|
1568
|
-
state.initialized &&
|
|
1569
|
-
!isRevalidationRequired &&
|
|
1570
|
-
isHashChangeOnly(state.location, location) &&
|
|
1571
|
-
!(opts && opts.submission && isMutationMethod(opts.submission.formMethod))
|
|
1572
|
-
) {
|
|
1573
|
-
completeNavigation(location, { matches }, { flushSync });
|
|
1574
|
-
return;
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
1578
|
// Create a controller/Request for this navigation
|
|
1578
1579
|
pendingNavigationController = new AbortController();
|
|
1579
1580
|
let request = createClientSideRequest(
|
|
@@ -2265,7 +2266,8 @@ export function createRouter(init: RouterInit): Router {
|
|
|
2265
2266
|
let discoverResult = await discoverRoutes(
|
|
2266
2267
|
requestMatches,
|
|
2267
2268
|
new URL(fetchRequest.url).pathname,
|
|
2268
|
-
fetchRequest.signal
|
|
2269
|
+
fetchRequest.signal,
|
|
2270
|
+
key
|
|
2269
2271
|
);
|
|
2270
2272
|
|
|
2271
2273
|
if (discoverResult.type === "aborted") {
|
|
@@ -2557,7 +2559,8 @@ export function createRouter(init: RouterInit): Router {
|
|
|
2557
2559
|
let discoverResult = await discoverRoutes(
|
|
2558
2560
|
matches,
|
|
2559
2561
|
new URL(fetchRequest.url).pathname,
|
|
2560
|
-
fetchRequest.signal
|
|
2562
|
+
fetchRequest.signal,
|
|
2563
|
+
key
|
|
2561
2564
|
);
|
|
2562
2565
|
|
|
2563
2566
|
if (discoverResult.type === "aborted") {
|
|
@@ -3280,7 +3283,8 @@ export function createRouter(init: RouterInit): Router {
|
|
|
3280
3283
|
async function discoverRoutes(
|
|
3281
3284
|
matches: AgnosticDataRouteMatch[],
|
|
3282
3285
|
pathname: string,
|
|
3283
|
-
signal: AbortSignal
|
|
3286
|
+
signal: AbortSignal,
|
|
3287
|
+
fetcherKey?: string
|
|
3284
3288
|
): Promise<DiscoverRoutesResult> {
|
|
3285
3289
|
if (!patchRoutesOnNavigationImpl) {
|
|
3286
3290
|
return { type: "success", matches };
|
|
@@ -3296,6 +3300,7 @@ export function createRouter(init: RouterInit): Router {
|
|
|
3296
3300
|
signal,
|
|
3297
3301
|
path: pathname,
|
|
3298
3302
|
matches: partialMatches,
|
|
3303
|
+
fetcherKey,
|
|
3299
3304
|
patch: (routeId, children) => {
|
|
3300
3305
|
if (signal.aborted) return;
|
|
3301
3306
|
patchRoutesImpl(
|