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

ErrorBoundary View Customization Not Working #1091

Open
RaviTejaM9602 opened this issue Dec 5, 2024 · 1 comment
Open

ErrorBoundary View Customization Not Working #1091

RaviTejaM9602 opened this issue Dec 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@RaviTejaM9602
Copy link

Custom Error View and Message in Not Working as Expected

When using the component with a view prop to provide a custom error view (e.g., it is directly showing ErrorView component when page gets loaded first irrespective of error.

I tried couple of ways but still I have the same problem with it. Could you please suggest me how can I show a generic message on UI when error was occured in the application.

#990

@RaviTejaM9602 RaviTejaM9602 added the bug Something isn't working label Dec 5, 2024
@yansavitski
Copy link
Contributor

Hey
Thank you for your question!

Based on your description, it seems the issue might be that the ErrorBoundary component is always rendering the ErrorView, even when no error has occurred. This could happen if there’s no condition in your custom view prop to check for the presence of an error.

Here’s what to verify:

  1. Your custom view should include a check for the error property. For example:
    const CustomErrorView = ({ error, children }) => { return error ? <div>{error}</div> : children; };
  2. Ensure that the ErrorBoundary is initialized correctly with the custom view:
    `
Some Content
`

If you’ve already added such a condition but the issue persists, please share the view code for ErrorBoundary and how it’s being initialized in your application. That would help identify the root cause more easily.

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

2 participants