Skip to content
Open
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
5 changes: 4 additions & 1 deletion src/routes/solid-start/advanced/auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ 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.

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.