You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It should be possible to see that a component has a componentDidCatch method. It would be nice if react-guard could optionally only catch errors at those error boundaries.
The issue is that we want/need to use the client-side error boundary on the client. The official solution allows us to define precisely how the errors are shown. But with react-guard on the server-side, we lose that control.
For example, imagine that the SVG icon in a submit button is throwing an error. On the client I can catch that at the form level and give the user a really nice message that replaces the whole form. This is a great user experience.
By contrast, react-guard would replace only that icon with a generic message. This might lead to a poor user experience.
Forgive me if I am missing something about how react-guard works.
The text was updated successfully, but these errors were encountered:
@heygrady basically react-guard was a solution before componentDidCatch was introduced.
react-guard just patches render method, surrounds it with try/catch and renders some generic message. componentDidCatch is more convenient and modern way to catch your exceptions from "children", on the other hand, react-guard just cares about exceptions in current component, not in children.
I guess what makes react-guard interesting now is that componentDidCatch does not work on the server but react-guard does.
I need to test this out myself but I was wondering if it would be possible to use the basic underpinnings of react-guard to enable a componentDidCatch (of a approximation of it) on the server. I have a need for error boundaries in my app but it's not great that my server-side-render would render a white screen while the client would be able to recover gracefully.
It should be possible to see that a component has a
componentDidCatch
method. It would be nice if react-guard could optionally only catch errors at those error boundaries.The issue is that we want/need to use the client-side error boundary on the client. The official solution allows us to define precisely how the errors are shown. But with react-guard on the server-side, we lose that control.
For example, imagine that the SVG icon in a submit button is throwing an error. On the client I can catch that at the form level and give the user a really nice message that replaces the whole form. This is a great user experience.
By contrast, react-guard would replace only that icon with a generic message. This might lead to a poor user experience.
Forgive me if I am missing something about how react-guard works.
The text was updated successfully, but these errors were encountered: