S
SolidJS16mo ago
Grahf

404 for dynamic routes

I'm trying to implement this: https://start.solidjs.com/api/HttpStatusCode#setting-a-404-status-code-for-missing-pages-for-dynamic-routes My route data looks like this:
export function routeData({ params }) {
return createServerData$(
async (value) => {
if (value !== 'dlk;d;fd;fak') {
throw new ServerError('Thing Not Found')
}
return { value }
},
{ key: () => params.title, deferStream: true },
)
}
export function routeData({ params }) {
return createServerData$(
async (value) => {
if (value !== 'dlk;d;fd;fak') {
throw new ServerError('Thing Not Found')
}
return { value }
},
{ key: () => params.title, deferStream: true },
)
}
Which is pretty much copy pasted from docs except I set it to always go off. In the browser I get a 400 error code: I never see this <div> displayed on the page. This code is pretty much copy pasted from the docs too.
<ErrorBoundary
fallback={(e) => (
<Show when={e.message === 'Thing Not Found'}>
<div>
<HttpStatusCode code={404} />
<h1 class='text-textColor text-8xl'>Wrong</h1>
</div>
</Show>
)}
>
<ErrorBoundary
fallback={(e) => (
<Show when={e.message === 'Thing Not Found'}>
<div>
<HttpStatusCode code={404} />
<h1 class='text-textColor text-8xl'>Wrong</h1>
</div>
</Show>
)}
>
SolidStart Beta Documentation
SolidStart Beta Documentation
Early release documentation and resources for SolidStart Beta
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server