Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notFoundMode: 'root' ignored when throw notFound #2416

Open
Semigradsky opened this issue Sep 26, 2024 · 1 comment
Open

notFoundMode: 'root' ignored when throw notFound #2416

Semigradsky opened this issue Sep 26, 2024 · 1 comment

Comments

@Semigradsky
Copy link

Which project does this relate to?

Router

Describe the bug

In doc I see (https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#notfoundmode-root) the example:

If provided the path of `/posts/1/edit`, the following component structure will be rendered:

- <Root>
- - <Root.notFoundComponent>

The notFoundComponent of the __root__ route will be rendered because the `notFoundMode` is set to `root`.

But I see another behaviour if I generate notFound error myself.

Your Example Website or App

https://stackblitz.com/edit/github-ovpjyk-3gh8gb?file=src%2Fmain.tsx

Steps to Reproduce the Bug or Issue

Try to open "Not found" or "Sub Not found" - they will be work as expected.

Try to open "Generate Not found" page - it works in another way

Expected behavior

I expect that it will be works the same as described in documentation.

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

@Semigradsky
Copy link
Author

Ok, I found in examples that notFound has not described option - global - https://tanstack.com/router/latest/docs/framework/react/api/router/notFoundFunction#examples

Throwing not found error like throw notFound({ global: true }) fixing my issue.

Please describe it better in documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant