Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated abortDelay property with RR7 streamTimeout #22

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions app/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PassThrough } from "node:stream"

Check failure on line 1 in app/entry.server.tsx

View workflow job for this annotation

GitHub Actions / ⬣ Biome lint

format

File content differs from formatting output
import { createReadableStreamFromReadable } from "@react-router/node"
import { createInstance } from "i18next"
import { isbot } from "isbot"
Expand All @@ -9,7 +9,8 @@
import i18nextOpts from "./localization/i18n.server"
import { resources } from "./localization/resource"

const ABORT_DELAY = 5000
// Reject all pending promises from handler functions after 10 seconds
export const streamTimeout = 10000

export default async function handleRequest(
request: Request,
Expand Down Expand Up @@ -38,7 +39,7 @@

const { pipe, abort } = renderToPipeableStream(
<I18nextProvider i18n={instance}>
<ServerRouter abortDelay={ABORT_DELAY} context={context} url={request.url} />
<ServerRouter context={context} url={request.url} />
</I18nextProvider>,
{
[callbackName]: () => {
Expand Down Expand Up @@ -67,6 +68,8 @@
}
)

setTimeout(abort, ABORT_DELAY)
// Abort the streaming render pass after 11 seconds so to allow the rejected
// boundaries to be flushed
setTimeout(abort, streamTimeout + 1000)
})
}
Loading