Skip to content

Commit 7928d3d

Browse files
committed
chore: format
1 parent 14666dd commit 7928d3d

File tree

11 files changed

+137
-135
lines changed

11 files changed

+137
-135
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ For more information, check out the [blog post](https://remix.run/blog/react-rou
385385
- `react-router` - Do not throw if the url hash is not a valid URI component ([#13247](https://github.com/remix-run/react-router/pull/13247))
386386
- `react-router` - Remove `Content-Length` header from Single Fetch responses ([#13902](https://github.com/remix-run/react-router/pull/13902))
387387
- `react-router` - Fix a regression in `createRoutesStub` introduced with the middleware feature ([#13946](https://github.com/remix-run/react-router/pull/13946))
388-
389388
- As part of that work we altered the signature to align with the new middleware APIs without making it backwards compatible with the prior `AppLoadContext` API
390389
- This permitted `createRoutesStub` to work if you were opting into middleware and the updated `context` typings, but broke `createRoutesStub` for users not yet opting into middleware
391390
- We've reverted this change and re-implemented it in such a way that both sets of users can leverage it

docs/explanation/form-vs-fetcher.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ Understanding the distinctions and intersections of these APIs is vital for effi
2323
The primary criterion when choosing among these tools is whether you want the URL to change or not:
2424

2525
- **URL Change Desired**: When navigating or transitioning between pages, or after certain actions like creating or deleting records. This ensures that the user's browser history accurately reflects their journey through your application.
26-
2726
- **Expected Behavior**: In many cases, when users hit the back button, they should be taken to the previous page. Other times the history entry may be replaced but the URL change is important nonetheless.
2827

2928
- **No URL Change Desired**: For actions that don't significantly change the context or primary content of the current view. This might include updating individual fields or minor data manipulations that don't warrant a new URL or page reload. This also applies to loading data with fetchers for things like popovers, combo boxes, etc.
@@ -228,7 +227,7 @@ function useMarkAsRead({ articleId, userId }) {
228227
{
229228
action: `/article/${articleId}/mark-as-read`,
230229
method: "post",
231-
}
230+
},
232231
);
233232
});
234233
}

docs/how-to/middleware.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,21 +226,21 @@ import { requestIdContext } from "~/context";
226226

227227
export const loggingMiddleware = async (
228228
{ request, context },
229-
next
229+
next,
230230
) => {
231231
const requestId = crypto.randomUUID();
232232
context.set(requestIdContext, requestId);
233233

234234
console.log(
235-
`[${requestId}] ${request.method} ${request.url}`
235+
`[${requestId}] ${request.method} ${request.url}`,
236236
);
237237

238238
const start = performance.now();
239239
const response = await next();
240240
const duration = performance.now() - start;
241241

242242
console.log(
243-
`[${requestId}] Response ${response.status} (${duration}ms)`
243+
`[${requestId}] Response ${response.status} (${duration}ms)`,
244244
);
245245

246246
return response;
@@ -252,7 +252,7 @@ export const loggingMiddleware = async (
252252
```tsx filename=app/middleware/error-handling.ts
253253
export const errorMiddleware = async (
254254
{ context },
255-
next
255+
next,
256256
) => {
257257
try {
258258
return await next();
@@ -271,15 +271,15 @@ export const errorMiddleware = async (
271271
```tsx filename=app/middleware/cms-fallback.ts
272272
export const cmsFallbackMiddleware = async (
273273
{ request },
274-
next
274+
next,
275275
) => {
276276
const response = await next();
277277

278278
// Check if we got a 404
279279
if (response.status === 404) {
280280
// Check CMS for a redirect
281281
const cmsRedirect = await checkCMSRedirects(
282-
request.url
282+
request.url,
283283
);
284284
if (cmsRedirect) {
285285
throw redirect(cmsRedirect, 302);
@@ -295,7 +295,7 @@ export const cmsFallbackMiddleware = async (
295295
```tsx filename=app/middleware/headers.ts
296296
export const headersMiddleware = async (
297297
{ context },
298-
next
298+
next,
299299
) => {
300300
const response = await next();
301301

@@ -363,7 +363,7 @@ export const unstable_middleware = [
363363
// Set data during action phase
364364
context.set(
365365
sharedDataContext,
366-
await getExpensiveData()
366+
await getExpensiveData(),
367367
);
368368
}
369369
return next();

docs/how-to/presets.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function myCoolPreset(): Preset {
3131
reactRouterConfig: () => ({
3232
serverBundles: ({ branch }) => {
3333
const isAuthenticatedRoute = branch.some((route) =>
34-
route.id.split("/").includes("_authenticated")
34+
route.id.split("/").includes("_authenticated"),
3535
);
3636

3737
return isAuthenticatedRoute
@@ -59,7 +59,7 @@ const serverBundles: ServerBundlesFunction = ({
5959
branch,
6060
}) => {
6161
const isAuthenticatedRoute = branch.some((route) =>
62-
route.id.split("/").includes("_authenticated")
62+
route.id.split("/").includes("_authenticated"),
6363
);
6464

6565
return isAuthenticatedRoute

docs/how-to/react-server-components.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ import { createFromReadableStream } from "react-server-dom-parcel/client.edge";
399399
export async function generateHTML(
400400
request: Request,
401401
fetchServer: (request: Request) => Promise<Response>,
402-
bootstrapScriptContent: string | undefined
402+
bootstrapScriptContent: string | undefined,
403403
): Promise<Response> {
404404
return await routeRSCServerRequest({
405405
// The incoming request.
@@ -421,7 +421,7 @@ export async function generateHTML(
421421
{
422422
bootstrapScriptContent,
423423
formState,
424-
}
424+
},
425425
);
426426
},
427427
});
@@ -463,10 +463,13 @@ function fetchServer(request: Request) {
463463
routes: routes(),
464464
// Encode the match with the React Server implementation.
465465
generateResponse(match) {
466-
return new Response(renderToReadableStream(match.payload), {
467-
status: match.statusCode,
468-
headers: match.headers,
469-
});
466+
return new Response(
467+
renderToReadableStream(match.payload),
468+
{
469+
status: match.statusCode,
470+
headers: match.headers,
471+
},
472+
);
470473
},
471474
});
472475
}
@@ -480,17 +483,18 @@ app.use(
480483
express.static("dist/client", {
481484
immutable: true,
482485
maxAge: "1y",
483-
})
486+
}),
484487
);
485488
// Hook up our application.
486489
app.use(
487490
createRequestListener((request) =>
488491
generateHTML(
489492
request,
490493
fetchServer,
491-
(routes as unknown as { bootstrapScript?: string }).bootstrapScript
492-
)
493-
)
494+
(routes as unknown as { bootstrapScript?: string })
495+
.bootstrapScript,
496+
),
497+
),
494498
);
495499

496500
app.listen(3000, () => {
@@ -524,7 +528,7 @@ setServerCallback(
524528
createFromReadableStream,
525529
createTemporaryReferenceSet,
526530
encodeReply,
527-
})
531+
}),
528532
);
529533

530534
// Get and decode the initial server payload.
@@ -548,10 +552,10 @@ createFromReadableStream(getRSCStream()).then(
548552
</StrictMode>,
549553
{
550554
formState,
551-
}
555+
},
552556
);
553557
});
554-
}
558+
},
555559
);
556560
```
557561

@@ -628,7 +632,7 @@ import {
628632

629633
export async function generateHTML(
630634
request: Request,
631-
fetchServer: (request: Request) => Promise<Response>
635+
fetchServer: (request: Request) => Promise<Response>,
632636
): Promise<Response> {
633637
return await routeRSCServerRequest({
634638
// The incoming request.
@@ -647,15 +651,15 @@ export async function generateHTML(
647651

648652
const bootstrapScriptContent =
649653
await import.meta.viteRsc.loadBootstrapScriptContent(
650-
"index"
654+
"index",
651655
);
652656

653657
return await renderHTMLToReadableStream(
654658
<RSCStaticRouter getPayload={getPayload} />,
655659
{
656660
bootstrapScriptContent,
657661
formState,
658-
}
662+
},
659663
);
660664
},
661665
});
@@ -698,7 +702,7 @@ function fetchServer(request: Request) {
698702
{
699703
status: match.statusCode,
700704
headers: match.headers,
701-
}
705+
},
702706
);
703707
},
704708
});
@@ -738,12 +742,12 @@ setServerCallback(
738742
createFromReadableStream,
739743
createTemporaryReferenceSet,
740744
encodeReply,
741-
})
745+
}),
742746
);
743747

744748
// Get and decode the initial server payload.
745749
createFromReadableStream<RSCServerPayload>(
746-
getRSCStream()
750+
getRSCStream(),
747751
).then((payload) => {
748752
startTransition(async () => {
749753
const formState =
@@ -763,7 +767,7 @@ createFromReadableStream<RSCServerPayload>(
763767
</StrictMode>,
764768
{
765769
formState,
766-
}
770+
},
767771
);
768772
});
769773
});

docs/how-to/server-bundles.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default {
2424
// ...
2525
serverBundles: ({ branch }) => {
2626
const isAuthenticatedRoute = branch.some((route) =>
27-
route.id.split("/").includes("_authenticated")
27+
route.id.split("/").includes("_authenticated"),
2828
);
2929

3030
return isAuthenticatedRoute

docs/upgrading/remix.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ For backwards-compatibility, there are a few ways to adopt `routes.ts` to align
149149
import { createRoutesFromFolders } from "@remix-run/v1-route-convention";
150150

151151
export default remixRoutesOptionAdapter(
152-
createRoutesFromFolders
152+
createRoutesFromFolders,
153153
) satisfies RouteConfig;
154154
```
155155

@@ -169,7 +169,7 @@ For backwards-compatibility, there are a few ways to adopt `routes.ts` to align
169169
route(":city", "concerts/city.tsx");
170170
});
171171
});
172-
}
172+
},
173173
) satisfies RouteConfig;
174174
```
175175

integration/rsc/rsc-test.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,25 +2273,25 @@ implementations.forEach((implementation) => {
22732273
// Verify loader data is passed
22742274
await page.waitForSelector("[data-loader-data]");
22752275
expect(await page.locator("[data-loader-data]").textContent()).toBe(
2276-
"Hello from client loader!"
2276+
"Hello from client loader!",
22772277
);
22782278

22792279
// Verify params are passed (empty for home route)
22802280
await page.waitForSelector("[data-params]");
22812281
await page.waitForSelector("[data-params-type]");
22822282
await page.waitForSelector("[data-params-count]");
22832283
expect(await page.locator("[data-params-type]").textContent()).toBe(
2284-
"typeof params: object"
2284+
"typeof params: object",
22852285
);
22862286
expect(await page.locator("[data-params-count]").textContent()).toBe(
2287-
"params count: 0"
2287+
"params count: 0",
22882288
);
22892289

22902290
// Verify matches are passed
22912291
await page.waitForSelector("[data-matches]");
22922292
await page.waitForSelector("[data-matches-ids]");
22932293
expect(await page.locator("[data-matches-ids]").textContent()).toBe(
2294-
"matches ids: root, home"
2294+
"matches ids: root, home",
22952295
);
22962296

22972297
// Submit the form to trigger the client action
@@ -2301,7 +2301,7 @@ implementations.forEach((implementation) => {
23012301
// Verify the action data is displayed
23022302
await page.waitForSelector("[data-action-data]");
23032303
expect(await page.locator("[data-action-data]").textContent()).toBe(
2304-
"Hello World from client action!"
2304+
"Hello World from client action!",
23052305
);
23062306

23072307
// Ensure this is using RSC
@@ -2358,21 +2358,21 @@ implementations.forEach((implementation) => {
23582358
await page.waitForSelector("[data-error-title]");
23592359
await page.waitForSelector("[data-error-message]");
23602360
expect(await page.locator("[data-error-title]").textContent()).toBe(
2361-
"Error Caught!"
2361+
"Error Caught!",
23622362
);
23632363
expect(await page.locator("[data-error-message]").textContent()).toBe(
2364-
"Intentional error from client loader"
2364+
"Intentional error from client loader",
23652365
);
23662366

23672367
// Verify params are passed to error boundary
23682368
await page.waitForSelector("[data-error-params]");
23692369
await page.waitForSelector("[data-error-params-type]");
23702370
await page.waitForSelector("[data-error-params-count]");
23712371
expect(
2372-
await page.locator("[data-error-params-type]").textContent()
2372+
await page.locator("[data-error-params-type]").textContent(),
23732373
).toBe("typeof params: object");
23742374
expect(
2375-
await page.locator("[data-error-params-count]").textContent()
2375+
await page.locator("[data-error-params-count]").textContent(),
23762376
).toBe("params count: 0");
23772377

23782378
// Ensure this is using RSC
@@ -2426,21 +2426,21 @@ implementations.forEach((implementation) => {
24262426
await page.waitForSelector("[data-error-title]");
24272427
await page.waitForSelector("[data-error-message]");
24282428
expect(await page.locator("[data-error-title]").textContent()).toBe(
2429-
"Error Caught!"
2429+
"Error Caught!",
24302430
);
24312431
expect(await page.locator("[data-error-message]").textContent()).toBe(
2432-
"Intentional error from server loader"
2432+
"Intentional error from server loader",
24332433
);
24342434

24352435
// Verify params are passed to error boundary
24362436
await page.waitForSelector("[data-error-params]");
24372437
await page.waitForSelector("[data-error-params-type]");
24382438
await page.waitForSelector("[data-error-params-count]");
24392439
expect(
2440-
await page.locator("[data-error-params-type]").textContent()
2440+
await page.locator("[data-error-params-type]").textContent(),
24412441
).toBe("typeof params: object");
24422442
expect(
2443-
await page.locator("[data-error-params-count]").textContent()
2443+
await page.locator("[data-error-params-count]").textContent(),
24442444
).toBe("params count: 0");
24452445

24462446
// Ensure this is using RSC
@@ -2502,18 +2502,18 @@ implementations.forEach((implementation) => {
25022502
// Verify the hydrate fallback is shown initially
25032503
await page.waitForSelector("[data-hydrate-fallback]");
25042504
expect(
2505-
await page.locator("[data-hydrate-fallback]").textContent()
2505+
await page.locator("[data-hydrate-fallback]").textContent(),
25062506
).toBe("Hydrate Fallback");
25072507

25082508
// Verify params are passed to hydrate fallback
25092509
await page.waitForSelector("[data-hydrate-params]");
25102510
await page.waitForSelector("[data-hydrate-params-type]");
25112511
await page.waitForSelector("[data-hydrate-params-count]");
25122512
expect(
2513-
await page.locator("[data-hydrate-params-type]").textContent()
2513+
await page.locator("[data-hydrate-params-type]").textContent(),
25142514
).toBe("typeof params: object");
25152515
expect(
2516-
await page.locator("[data-hydrate-params-count]").textContent()
2516+
await page.locator("[data-hydrate-params-count]").textContent(),
25172517
).toBe("params count: 0");
25182518

25192519
// Unblock the client loader to allow it to complete

0 commit comments

Comments
 (0)