From 5b0721fe127a61968dd5ff52f7cdacb084bc294e Mon Sep 17 00:00:00 2001 From: Kyle Zheng Date: Tue, 23 Dec 2025 15:08:08 -0500 Subject: [PATCH 1/2] add deferStream: true to auth code example --- src/routes/solid-start/advanced/auth.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/routes/solid-start/advanced/auth.mdx b/src/routes/solid-start/advanced/auth.mdx index b77162ee0a..69be1a8fac 100644 --- a/src/routes/solid-start/advanced/auth.mdx +++ b/src/routes/solid-start/advanced/auth.mdx @@ -50,9 +50,11 @@ const getPrivatePosts = query(async function() { }) export default function Page() { - const posts = createAsync(() => getPrivatePosts()); + const posts = createAsync(() => getPrivatePosts(), { deferStream: true }); } ``` Once the user hits this route, the router will attempt to fetch `getPrivatePosts` data. If the user is not signed in, `getPrivatePosts` will throw and the router will redirect to the login page. + +Setting `{ deferStream: true }` will wait until `getPrivatePosts` resolves before loading the page. Otherwise, opening the page directly will error, because server side redirects cannot occur after an initial response has streamed to the client. From 8412d9801b7375c202e8226aee2294cfafadbd0a Mon Sep 17 00:00:00 2001 From: Kyle Zheng <45705859+zhengkyl@users.noreply.github.com> Date: Tue, 23 Dec 2025 16:46:10 -0500 Subject: [PATCH 2/2] Update src/routes/solid-start/advanced/auth.mdx Co-authored-by: Sarah --- src/routes/solid-start/advanced/auth.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/solid-start/advanced/auth.mdx b/src/routes/solid-start/advanced/auth.mdx index 69be1a8fac..2fe5c199ca 100644 --- a/src/routes/solid-start/advanced/auth.mdx +++ b/src/routes/solid-start/advanced/auth.mdx @@ -57,4 +57,5 @@ export default function Page() { Once the user hits this route, the router will attempt to fetch `getPrivatePosts` data. If the user is not signed in, `getPrivatePosts` will throw and the router will redirect to the login page. -Setting `{ deferStream: true }` will wait until `getPrivatePosts` resolves before loading the page. Otherwise, opening the page directly will error, because server side redirects cannot occur after an initial response has streamed to the client. +To prevent errors when opening the page directly, set `deferStream: true`. +This would ensure `getPrivatePosts` resolves before the page loads since server-side redirects cannot occur after streaming has started.