-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[Bug]: fetcher.load to "resource route" fails with 404 presumably because route has not been discovered yet #13114
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
Comments
We are facing the same issue. For now, as a workaround, we are adding |
yes we are facing it as well :( |
hey @brophdawg11, I am not able to create a simple project that can reproduce this. If this issue rings a bell and you can give me some pointers I can try creating a repro project. |
What do you mean you are adding it to the routes? Can you elaborate with an example? This is driving me crazy as well. Thanks |
not sure it helps anyone but In our case we found out that cloudfront cached the _manifest requests without looking at the version search param (default behavior) 😬 , even if the route was inside the old manifest it didnt had the correct version so it still caused this error. |
Nice suggestion, @hasanayan ! Does it trigger the error though, or does it just inform Remix that the route exists, to prevent throwing the error ? Where exactly have you put that link ? On a public page or a private page is enough ? Are you using the Link as-is, or are you also doing |
We are using it as is. I think this causes eager/forced discovery of the route before the problematic
Based on our experience and what has been written here, we get this error after some For our case we are placing it the exact routes we are doing I think you can place those in the default component exported by PLEASE NOTE: This is not an actual fix. It's just a workaround and hopefully Did anyone manage to reproduce this in a small project? |
Can anyone provide a minimal repro where this happens? Does the page with the fetcher have new Link's on it that also need to be discovered? If so, it could be a race condition between the manifest loads for those and the manifest load for the fetcher call. Hard to be sure without a reproduction though... |
I'll try to add a reproduction by tomorrow, for now the following should suffice: |
Another thought: an option to opt out of lazy route discovery altogether wouldn’t be too bad, I guess. |
I ran into this issue as well, my loader is inside a Dialog that loads on user interaction, not initial load; when called, it returns 404. I added a hidden link in my component so that the route is loaded from the start: <NavLink to="/my-search?query=" className="hidden"> This hack is far from ideal, but at least gets the routes working. |
Same issue here. The following workaround works for me as well: setTimeout(() => fetcher.load("/some/route"), 50) |
Hey folks - I'm still not able to reproduce this - I've got a stackblitz setup with a few parallel discovery requests from eager route discovery, navigations, and fetchers, and everything seems to be working fine. Upon loading the It's also worth noting that we are adding an option to disable Lazy Route discovery (#13451) so that will be available in the next release as an option too. I'm going to close this out as not reproducible for now but please post a stackblitz reproduction if you can create one and we can reopen. |
I'm encountering this error too, and I was able to create a minimal reproduction of it: Click the "Second - SSR" link and you'll see the 404 error. (This is also happening with other loaders in my app besides the |
Thanks for the repro! Fixed in #13564 and will be available in the next release 👍 |
Awesome, thanks @brophdawg11 ! |
🤖 Hello there, We just published version Thanks! |
Uh oh!
There was an error while loading. Please reload this page.
I'm using React Router as a...
framework
Reproduction
I've linked a PR with a failing test: #13117
I have the following hook in my avatar component that fetches the current user's info:
This works must of the time but I have found that on some navigations I'm getting the following error in my Error Handler for my route:
This should be impossible as that route should never respond with a 404.
While I was on Remix, I could fix this issue by turning off "lazy route discovery" but not that we've migrated to React-Router there is no way to disable lazy route discovery. My thinking is that this loader is being called before the resource route has had a change to be discovered thus it's returning a 404.
One possible solution is to give me a way to opt specific routes out of lazy route discovery (ie they are always included in the original manifest).
System Info
Used Package Manager
pnpm
Expected Behavior
I expect to be able to fetch data from a resource route without getting a 404 response.
Actual Behavior
The loader is returning a 404 error (presumably because the route hasn't been discovered yet).
The text was updated successfully, but these errors were encountered: