Skip to content

Difficult to debug non-browser context class of JS errors #42

@lencioni

Description

@lencioni

When using the prerender option, react-rails will rescue any JavaScript errors. This will log it and continue, which will just render the react ujs tag, and when the browser tries to render the component it will most likely encounter the same error and throw to the browser console for a better debugging experience.

While this may be the case for some JS errors, it is not the case for errors that happen when running JS not in the browser context but that don't happen when running JS in the browser context. For example, the window object is available in the browser context but not available in the non-browser context, causing errors like "window is not defined". By rescuing these exceptions, seeing that something is broken in these situations is difficult.

What do you think about not rescuing JS exceptions when prerendering? This would make debugging in these situations quite a bit less mysterious. Folks who want a better debugging environment for JS errors that happen on the client side should be able to easily disable prerender.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions