-
Notifications
You must be signed in to change notification settings - Fork 800
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
Support MobX (HOC Decorators) #601
Comments
I don't get the |
Same thing happens with withRouter from React Router. Remount instead of replacing. |
This is expected. Patch cant see all @inject('todos')
@observer
class Navigator extends React.Component ... Will give you ONE class. But by the fact, you are creating TREE! See https://codeburst.io/how-to-hot-load-react-component-in-7-days-part-2-react-28ce2b61d0c7 |
Is there any update on this? |
Still an issue.
I do get something new if I comment out the
The
If I ditch the decorators and use them directly:
|
We have several known issues that explain this result:
There are complicated to solve, help is welcome. |
@theKashey this is linked to #279 right? We should focus on this case and implement a MobX example. |
Was failing with v3 - cos MobX hides class from RHL, and it will be unmounter If you will wrap Routes with import React from 'react';
import {hot} from 'react-hot-loader';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import Root from '../root/root';
export default hot(module)(function Routes() {
return (
<BrowserRouter>
<Switch>
<Route exact path="/" component={Root} />
</Switch>
</BrowserRouter>
);
}) |
@theKashey I've updated the repo with
I've also tried your example wrapping The test repo link again: ResultsAfter changing
Root render
Navigator: constructor
Hello: constructor
+ Root render
+ Navigator: constructor
+ Navigator: constructor
+ Root render
Continued...
Root render
Navigator: constructor
Hello: constructor
+ Navigator: constructor
+ Navigator: constructor
+ Navigator: constructor
+ Navigator: constructor
+ Root render
+ Root render
|
Oh hot module update RHL will “probe” all components, creating and rendering them. |
Ahm, for a second I got confused as what was I expecting from RHL in the first place. So I watched Dan Abramov's talk on Hot Reloading with Time Travel again. The key points, in my words:
Wasn't that the whole point of RHL? (besides not reloading the whole page) As it is now, the component does remount, and I would lose component state. |
@alexilyaev I fork your project add I added a demo, no mount/unmount occurs. The constructor is called but it is the normal behaviour. |
@neoziro Oh, I stand corrected, But this is true only with the Will post some more test results soon. |
@alexilyaev - you have to wrap your Application with AppContainer or use Also - Dan's video was about RHL v1. Here we got v4 - it is a bit different. All messages you can saw - is from dry-run. They are not related to the |
Good NewsI've updated the repo to have running counters:
Results
Conclusions
|
|
The next documentation, it is very simple now. |
Oh cool, what a relief 😊. Closing. |
Description
Two things I've noticed:
@inject
frommobx-react
, changing something inrender
causes the component to re-mount, instead of hot reloadedcomponentWillUnmount
in that case, the browser will reload and we don't see the exception in the console, unless we enable Preserve Log (which is off usually).Expected behavior
Actual behavior
The component re-mounted and the browser reloaded.
Environment
Reproducible Demo
Tried to dumb it down to a minimal reproduction demo:
https://github.com/alexilyaev/react-hmr-uncaught-error
app/components/navigator/navigator.js
to something else and save.[HMR] Cannot apply update. Need to do a full reload!
and then the
123
error.Thanks.
The text was updated successfully, but these errors were encountered: