Skip to content

Commit

Permalink
fix: move react-dom notification to AppContainer, fixes #1227
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed May 16, 2019
1 parent f036d36 commit 28bfdd4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/AppContainer.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ class AppContainer extends React.Component {
generation: 0,
};

constructor(props) {
super(props);
if (configuration.showReactDomPatchNotification) {
configuration.showReactDomPatchNotification = false;
console.warn('React-Hot-Loader: react-🔥-dom patch is not detected. React 16.6+ features may not work.');
}
}

shouldComponentUpdate(prevProps, prevState) {
// Don't update the component if the state had an error and still has one.
// This allows to break an infinite loop of error -> render -> error -> render
Expand Down
3 changes: 3 additions & 0 deletions src/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const configuration = {
// Disable "hot-replacement-render" when injection into react-dom is made
disableHotRendererWhenInjected: false,

// Controls `react-🔥-dom patch` notification
showReactDomPatchNotification: true,

// Hook on babel component register.
onComponentRegister: false,

Expand Down
4 changes: 1 addition & 3 deletions src/reactHotLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,8 @@ const reactHotLoader = {
configuration.ignoreSFC = configuration.ignoreSFCWhenInjected;

reactHotLoader.IS_REACT_MERGE_ENABLED = true;
configuration.showReactDomPatchNotification = false;
// console.warn('react-🔥-loader activated.');
} else {
// Actually everything works...
console.warn('React-Hot-Loader: react-🔥-dom patch is not detected. React 16.6+ features may not work.');
}
/* eslint-enable */
if (!React.createElement.isPatchedByReactHotLoader) {
Expand Down

0 comments on commit 28bfdd4

Please sign in to comment.