gaearon / gaearon/react-hot-loader

RHL does not work if runtime error occurred

Open
#987 10 comments 0 reactions 1 assignee Claimed by @theKashey View on GitHub
bug discussion
Dominant language
JavaScript
Stars
12.2k
Forks
775
PR merge metrics
No merged PRs in 30d

Description

**Description:**
I have a component, if I make a runtime error inside render, nothing happens.

For Example:
```
const App = () => (

No Errors

);

// when changed to

const App = () => (

{UndefinedVariable.field}

);
```

**Current behaviour**
HMR says app is up to date. As a result, I do not know if my change applied, or it crashed.

The logger prints the error as warning in debug mode, in simple app example and does not show anything new in the large app, that already has some warnings.

**Expected behavior**
At the very least I would expect a reload that would show me the error afterwards.

As a step up, I would expect to have a way to connect my errorHandling for internal errors within HMR. Possibly with the real error message.

Could join both and make default behaviour reload page, but if given errorHandler, execute it instead.

As an alternative, simply throwing the original error is good enough. We only have warning at the moment, so it is not trackable.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.