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

fix(track-trail-updates): added ability to turn off trailing updates … #1387

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,9 @@ export default hot(Hello); // <-- module will reload itself
Wrapping this root component with `hot()` will ensure that it is hot reloaded correctly.

### Out-of-bound warning

You may see the following warning when code-split components are updated:

```console
React-Hot-Loader: some components were updated out-of-bound. Updating your app to reconcile the changes.
```
Expand All @@ -447,6 +449,9 @@ in the configuration or useage of `react-hot-loader`.
If the tail update detection is not something you want or need, you can disable this behavior by setting
`setConfig({ trackTailUpdates:false })`.

Alternatively, if you want trail detection but don't want the logging, you can pass `setConfig({ trackTailUpdates:false })`.
This will keep it enabled but suppress the warnings.

### Checking Element `type`s

Because React Hot Loader creates proxied versions of your components, comparing
Expand Down
9 changes: 6 additions & 3 deletions src/hot.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ const makeHotExport = (sourceModule, moduleId) => {
// we know that some components were updated, but not tracking which ones
// even if their updates might be incorporated automatically (like lazy)
// we dont know which one should be tracked, and which updates are important
console.warn(
'React-Hot-Loader: some components were updated out-of-bound. Updating your app to reconcile the changes.',
);
if (typeof configuration.trackTailUpdates === 'boolean' && configuration.trackTailUpdates) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's true by default, and is a condition to run this branch.

// Disable logging because user passed 'true'... they are aware they should be tracked.
console.warn(
'React-Hot-Loader: some components were updated out-of-bound. Updating your app to reconcile the changes.',
);
}
deepUpdate();
} else if (++runLimit < 5) {
checkTailUpdates();
Expand Down