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

notFoundComponent doesn't render when notFound is thrown in the loader since 1.28.2 #1551

Open
GuillaumeLaroucheUQAT opened this issue May 2, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@GuillaumeLaroucheUQAT
Copy link

GuillaumeLaroucheUQAT commented May 2, 2024

Describe the bug

A route wrapped in Suspense either by setting the prop wrapInSuspense to true or defining a pendingComponent doesn't render the notFoundComponent or the defaultNotFoundComopnent when the notFound function is thrown in the loader.

Your Example Website or App

https://codesandbox.io/p/devbox/beautiful-archimedes-7vwmwj

Steps to Reproduce the Bug or Issue

To reproduce :

  1. Go to index route
  2. Loading is rendered instead of Not found

Things that doesn't trigger the bug :

  • There is no Promise in the loader or the Promise is faster
  • The prop wrapInSuspense is set to false
  • The prop pendingComponent is not set

Expected behavior

The prop notFoundComponent should be rendered when the notFound function is thrown in the loader even if the route is wrapped in Suspense and the Promise is taking longer to resolve.

Screenshots or Videos

No response

Platform

  • OS: Windows
  • Browser: Chrome
  • Version: 124

Additional context

No response

@kcoet
Copy link

kcoet commented May 13, 2024

router.hasNotFoundMatch() also always returns false, I think this is related.

@ColoredCarrot
Copy link

Also ran into this today. This seems to be an intermittent issue; roughly 10% of the time, the notFound component is shown correctly. Maybe there's a race somewhere?
Maybe useful: When the bug appears, the router devtools show that the route's loaderPromise is pending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants