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

[v4] Second reload doesn't work #819

Closed
vojty opened this issue Jan 25, 2018 · 5 comments
Closed

[v4] Second reload doesn't work #819

vojty opened this issue Jan 25, 2018 · 5 comments

Comments

@vojty
Copy link

vojty commented Jan 25, 2018

Description

I am having troubles with migration to webpack 3 and react-hot-loader v4.
The first reload works fine, but the second one fails with Ignored an update to unaccepted module ./app/components/NewRoot.jsx -> ./app/Bridge.jsx

app.jsx

import { Provider } from 'react-redux';
import Bridge from './Bridge';
...
    ReactDOM.render(
        <Provider store={store}>
            <Bridge history={history} />
        </Provider>,
        document.getElementById('app-analyze')
    );

bridge.jsx

import React from 'react';
import { hot } from 'react-hot-loader';
import { Route } from 'react-router-dom';
import { ConnectedRouter } from 'react-router-redux';

import NewRoot from './components/NewRoot';
import ConnectedIntlProvider from './utils/with_connected_intl'; // just React-intl IntlProvider wrapped with connect
const routes = <Route path="/" component={NewRoot} />;

const Bridge = ({ history }) => (
    <ConnectedIntlProvider>
        <ConnectedRouter history={history}>
            {routes}
        </ConnectedRouter>
    </ConnectedIntlProvider>
);

export default hot(module)(Bridge);

NewRoot.jsx

import React from 'react';
import { connect } from 'react-redux';
import { injectIntl } from 'react-intl';
import rootSelector from '../selectors/root_selector';

class NewRoot extends React.Component {
    render() {
        return (
            <div>
                ABC DEF
            </div>
        );
    }
}

const dispatchToProps = {
    test: () => {}
};

export default connect(rootSelector, dispatchToProps)(injectIntl(NewRoot));

.babelrc

{
  "presets": [
    [ "env", { "modules": false } ],
    "react",
    "stage-2"
  ],
  "env": {
    "test": {
      // Only for testing components (NODE_ENV = 'test') in NodeJS, which needs CJS to work
      "plugins": [ "transform-es2015-modules-commonjs" ]
    },
    "development": {
      "plugins": ["react-hot-loader/babel"]
    },
    "production": {
      "plugins": ["lodash"]
    }
  }
}

Environment

...
    "react": "15.3.2",
    "react-dnd": "2.1.4",
    "react-dom": "15.3.2",
    "react-intl": "2.4.0",
    "react-redux": "5.0.6",
    "react-router": "4.2.0",
    "react-router-dom": "4.2.2",
    "react-router-redux": "5.0.0-alpha.9",
...

Any ideas what am I doing wrong?

@theKashey
Copy link
Collaborator

This is not related to React-hot-loader, only to webpacks HRM. If you will google "Ignored an update to unaccepted module " - you will found that a lot of people face it before, including the same case with react-hot-loader.
#354, for example.
Unfortunately I did not saw any solution among all these issues, I could share with you.

Just double check you consume NewRoot, and how application works. Next you could try to run RHL v4 as v3 - they are using absolutely different approaches to "accept" the change.

@theKashey
Copy link
Collaborator

Should be bound to #820

@theKashey
Copy link
Collaborator

Yep, the same - redux causes stand-in to throw a warning, but logger is broken. As result - full page refresh.

@gregberge
Copy link
Collaborator

Fixed in 4.0.0-beta.18.

@vojty
Copy link
Author

vojty commented Jan 26, 2018

it works, thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants