#Splat route not rendering anything

1 messages · Page 1 of 1 (latest)

pearl vessel
#

I have a splat route set up to catch 404s. In its loader, I'm throwing a 404 with new Response(...) like I do anywhere else. Unlike every other route in the app, however, when the splat matches, it only renders the Response message, not a CatchBoundary or anything else, for that matter. For instance, if I have something like throw new Response(`${new Date().toLocaleString()}: page at "${params["*"]}" not found`, { status: 404 });
in the browser I'll only see 12/8/2022, 2:05:20 PM: page at "nothing/here" not found and nothing else—nothing from the root route, no existing CatchBoundary, etc.

I assumed a this would send me down the catch boundary path, but it clearly isn't. Am I missing a convention or making an obvious error in my thinking with this?

#

The output from npx remix routes also looks correct to me:

  <Route file="root.jsx">
    <Route path="about-us/blog/:slug" file="routes/about-us.blog.$slug.jsx" />
    <Route path="development/:slug" file="routes/development.$slug.jsx" />
    <Route path="innovation/:slug" file="routes/innovation.$slug.jsx" />
    <Route path="about-us/:slug" file="routes/about-us.$slug.jsx" />
    <Route path="products/:slug" file="routes/products.$slug.jsx" />
    <Route path="services/:slug" file="routes/services.$slug.jsx" />
    <Route path="sitemap.xml" file="routes/[sitemap.xml].jsx" />
    <Route path="humans.txt" file="routes/[humans.txt].jsx" />
    <Route path="robots.txt" file="routes/[robots.txt].jsx" />
    <Route path="contact-us" file="routes/contact-us.jsx" />
    <Route path="news/:slug" file="routes/news.$slug.jsx" />
    <Route path=":slug" file="routes/$slug.jsx" />
    <Route index file="routes/index.jsx" />
    <Route path="*" file="routes/$.jsx" />
  </Route>
</Routes>```
mild tree
#

Does your splat route have a component? I think there's a known behavior where resource route errors won't end up at a CatchBoundary

pearl vessel
solid idol
#

When this happened to me before, it was because my route wasn't exporting a component. I have a bunch of routes now that just redirect (or 404) but also have export default function() { return null; } in them so that remix lets it render a normal 404

#

but it sounds like that's not it...