-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
An error in MetaFunction
or LinkFunction
is not caught by ErrorBoundary
#3140
Comments
This is a problem for me as well, I just wanted to add that for me the real error happened in the LoaderFunction and the MetaFunction threw an error when trying to access that data.
Do we want errors in the MetaFunction to actually trigger the ErrorBoundary? The application can probably render ok most of the time and fall back to a parent MetaFunction. This is what I did in my application to handle this for now.
This will fall back to the parent MetaFunction if an error in just the MetaFunction, and if the error is actually in a LoaderFunction that ErrorBoundary is activated. |
MetaFunction
or LinkFunction
is not caught by ErrorBoundary
This happened to me too. |
okay, this has do with the |
I think passing errors in loader to MetaFunction makes sense, then ignore MetaFunction and LinksFunction errors (maybe log them to the console) |
I have just encountered this, and I find it quite odd that |
So I'm not sure if it is related, but I have a similar issue when I throw The reason that we want this is that we just use the index route to redirect to another page based on the user's authorized workspaces. If there are no workspaces with that user it should trigger the
|
@AvidDabbler this is expected, a route without a default export is a resource route and resource routes don't participate in the UI so they don't render an error boundary. If you consume the resource route from a useFetcher it will handle errors, but if you go directly on the browser it will show what the loader returned, in your case the JSON of the bad request. |
Awesome! thanks for the clarification
…On Wed, Jun 28, 2023 at 6:13 PM Sergio Xalambrí ***@***.***> wrote:
@AvidDabbler <https://github.com/AvidDabbler> this is expected, a route
without a default export is a resource route and resource routes don't
participate in the UI so they don't render an error boundary.
If you consume the resource route from a useFetcher it will handle errors,
but if you go directly on the browser it will show what the loader
returned, in your case the JSON of the bad request.
—
Reply to this email directly, view it on GitHub
<#3140 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACAUJTFRAR535G3DPIBJ643XNS277ANCNFSM5VO2Q6YA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I think the proper fix here would be to decouple the execution of If we run meta after loaders during the |
I think in v2 we should at least render the root error boundary. This all changes quite a bit with RSC ( |
What version of Remix are you using?
1.4.1
Steps to Reproduce
Create a MetaFunction with an error inside:
Or create a LinkFunction:
This can happen if, for example, you access a property of data that doesn't exists.
Expected Behavior
It should show the ErrorBoundary from the route or parent route.
Actual Behavior
It shows a
Unexpected Server Error
white screen with black text and the error message below.The text was updated successfully, but these errors were encountered: