SolidJSS
SolidJSโ€ข3y 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 },
  )
}


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>
      )}
    >
image.png
SolidStart Beta Documentation
Early release documentation and resources for SolidStart Beta
SolidStart Beta Documentation
Was this page helpful?