Skip to content
25 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

The sidebar asks billing whether it is on, not for the account, so no page waits on the card processor1import { renderToReadableStream } from "react-dom/server";
2import { type EntryContext, ServerRouter } from "react-router";
3
4/**
5 * Renders the whole page before sending it. sudo ships no JavaScript, so
6 * there is nothing to stream into and no inline script to allow.
7 */
8export default async function handleRequest(
9 request: Request,
10 responseStatusCode: number,
11 responseHeaders: Headers,
12 routerContext: EntryContext,
13) {
14 let status = responseStatusCode;
15 const body = await renderToReadableStream(<ServerRouter context={routerContext} url={request.url} />, {
16 signal: request.signal,
17 onError(error: unknown) {
18 status = 500;
19 console.error(error);
20 },
21 });
22 await body.allReady;
23 responseHeaders.set("content-type", "text/html; charset=utf-8");
24 return new Response(body, { headers: responseHeaders, status });
25}

This file's history is long; its oldest lines are credited to the oldest commit read.