Comments (15)
I believe this has to do w/ some incorrect stuff that was happening in the app, though I don't know exactly what yet. This may be something that should never normally happen.
from react-redux.
Ok, so here's what we were doing... in componentWillMount
we fired an action via setTimeout
so that the react-redux
subscription in componentDidMount
will have already happened by the time the action is dispatched. It appears that this is a bad idea, though I do not understand why.
from react-redux.
OK I introduced this bug while tweaking @gnoff's code. :-(
Will push out a fix soon.
from react-redux.
Can you verify the bug is fixed in 0.5.1
?
from react-redux.
yep, it is. But then I get this:
Uncaught Error: Invariant Violation: Component (with keys: getDOMNode,_handleChange,props,context,state,refs,_reactInternalInstance) contains `render` method but is not mounted in the DOM
which makes me think we're doing something very wrong. By removing the setTimeout
in componentWillMount
it works out.
What's the right way to fire an action when a component mounts? If the action immediately modifies state, componentWillMount
is too soon, because react-redux doesn't subscribe until componentDidMount
...
from react-redux.
contains
render
method but is not mounted in the DOM
I found this: facebook/react#4233.
Sounds like React throws if you use findDOMNode(this)
when component is already unmounted. You should clear any previously set interval in componentWillUnmount
.
If the action immediately modifies state, componentWillMount is too soon, because react-redux doesn't subscribe until componentDidMount.
What do you mean by "too soon"? If React Redux doesn't update in some edge case, it's a bug, no matter where you call dispatch
! You should file an issue, not just accept it like that. 😄
from react-redux.
I just assume that you've thought of everything and there's a good reason it is as it is! I'll make sure it is what I think it is and file an issue when I get a sec. Thanks!
from react-redux.
Keeping it open for now so I don't forget about it.
I make mistakes all the time, you should help me figure them out!
from react-redux.
Ideally, the fastest way to figure out a solution is to discuss a failing test. Can I ask you to contribute it?
from react-redux.
Looks like you beat me to it! feel free to close #31, thanks. Btw, is there a reason to do it this way instead of by subscribing in componentWillMount
?
from react-redux.
Yes, componentWillMount
executes on server. This would cause memory leaks.
from react-redux.
The second error I saw is actually this: facebook/react#2410
I'm not sure why yet, in my case, it has to do w/ clicking submit on a form triggering a router transition. I'll keep digging
from react-redux.
If you can reliably reproduce it on a small project let the folks know. It could be a React bug after all.
Are you by chance using React.addons.batchedUpdates or similar? Not saying I understand the issue but if so, try removing it and check if it makes the bug go away. I've heard about problems with batching and inputs although not sure what kind. Sorry if this is too vague. :-)
from react-redux.
We are, but removing it has no effect. I'll work on a small repro.
from react-redux.
You may be following that thread, so you may have seen it, but here's a repro: https://github.com/aaronjensen/react-2410-repro
The error does not happen if this line is removed: https://github.com/aaronjensen/react-2410-repro/blob/master/app/create_router.jsx#L10
from react-redux.
Related Issues (20)
- Unable to resolve module react-dom HOT 10
- Jest: Module import syntax error HOT 9
- Unable to resolve peer dependency react-native on [email protected] HOT 1
- TypeError: dispatcher.useSyncExternalStore is not a function HOT 1
- where development or production mode should be specified? HOT 7
- After some time useSelector stops doing re-renders HOT 8
- Provider properties for dev checks to be passed explicitly to new devModeChecks property HOT 7
- Getting Syntax error for react-redux when building project HOT 4
- Connect not working with detox envinronment HOT 1
- Getting issue in middleware of configureStore when update redux-toolkit to 2.0.1 HOT 1
- useDispatch() causing unexpected navigate back to previous screen HOT 3
- Single global store and two Provider occurs an error for microfrontend app HOT 1
- Test fail with provider in react-native HOT 3
- useSelector hook seems to break hook parsing in React Developer Tools HOT 2
- TypeScript: not possible to use a component's `store` and `context` props when wrapped with `connect` HOC HOT 2
- docs: v9.0.0 release missing information HOT 1
- Connected children components might have mapStateToProps not called HOT 18
- Website search is broken HOT 2
- Hooks API Reference uses misnamed type in the useSelector() example HOT 1
- Include UMD build artifacts for latest release HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-redux.