Skip to content

Commit cbe3378

Browse files
committed
code style
1 parent 28a7351 commit cbe3378

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

packages/react-router/lib/router/router.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3656,9 +3656,7 @@ export function createStaticHandler(
36563656
let res = await generateMiddlewareResponse(
36573657
async (
36583658
revalidationRequest: Request,
3659-
{
3660-
filterMatchesToLoad = filterMatchesToLoadBase,
3661-
}: {
3659+
opts: {
36623660
filterMatchesToLoad?:
36633661
| ((match: AgnosticDataRouteMatch) => boolean)
36643662
| undefined;
@@ -3672,7 +3670,9 @@ export function createStaticHandler(
36723670
dataStrategy || null,
36733671
skipLoaderErrorBubbling === true,
36743672
null,
3675-
filterMatchesToLoad || null,
3673+
"filterMatchesToLoad" in opts
3674+
? (opts.filterMatchesToLoad ?? null)
3675+
: null,
36763676
skipRevalidation === true,
36773677
);
36783678

packages/react-router/lib/rsc/server.rsc.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -716,19 +716,17 @@ async function generateRenderResponse(
716716
runningAction: false,
717717
};
718718

719-
const queryOptions = routeIdsToLoad
720-
? {
721-
filterMatchesToLoad: (m: AgnosticDataRouteMatch) =>
722-
routeIdsToLoad!.includes(m.route.id),
723-
}
724-
: {};
725-
726719
const result = await ServerStorage.run(ctx, () =>
727720
staticHandler.query(request, {
728721
requestContext,
729722
skipLoaderErrorBubbling: isDataRequest,
730723
skipRevalidation: isSubmission,
731-
...queryOptions,
724+
...(routeIdsToLoad
725+
? {
726+
filterMatchesToLoad: (m: AgnosticDataRouteMatch) =>
727+
routeIdsToLoad!.includes(m.route.id),
728+
}
729+
: {}),
732730
async unstable_generateMiddlewareResponse(query) {
733731
// If this is an RSC server action, process that and then call query as a
734732
// revalidation. If this is a RR Form/Fetcher submission,
@@ -780,11 +778,14 @@ async function generateRenderResponse(
780778
}
781779
}
782780

783-
if (skipRevalidation) {
784-
queryOptions.filterMatchesToLoad = () => false;
785-
}
786-
787-
let staticContext = await query(request, queryOptions);
781+
let staticContext = await query(
782+
request,
783+
skipRevalidation
784+
? {
785+
filterMatchesToLoad: () => false,
786+
}
787+
: undefined,
788+
);
788789

789790
if (isResponse(staticContext)) {
790791
return generateRedirectResponse(

0 commit comments

Comments
 (0)