Implementing Global NotFound Page with SSR using Vinxi and TanStack Router #1164
Unanswered
AndrejNemec
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm encountering a challenge with my SSR application using Vinxi and TanStack Router, specifically with implementing a global NotFound page for routes that do not exist. My application uses file-based routing, and while defined routes render correctly, undefined routes do not render within the
__root.tsx
component as expected. Here's the relevant code setup:For routes
/
and/about
, everything renders as expected. However, navigating to an undefined route does not trigger the__root.tsx
layout to wrap around the NotFound page. Instead, it directly outputs a basic Not Found message without applying any of the root component's layout or styles.HTML result:
I've attempted the following methods without success:
NotFoundRoute
approach, which technically works but isn't ideal because it is deprecated:notFoundComponent
to the__root
component in hopes of enforcing the root layout for not found pages. However, the issue persists: my code is not encapsulated by the__root
layout for undefined routes.I am looking for guidance on how to properly implement a global NotFound page using the current version of TanStack Router that integrates seamlessly with SSR and file-based routing. The documentation seems unclear on this, and I haven't found any examples that address a global NotFound scenario in this context.
Could anyone provide insights or point me toward an example or documentation that clearly explains how to set this up?
Thank you in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions