v4.4.4 appears to prevent components from receiving context changes
See original GitHub issueI have a project based on https://github.com/erikras/react-redux-universal-hot-example and one of my components needs to check router.isActive(someUrl)
whenever a route changes and update its style/markup. The router object is accessible from components via context. Since react-redux
v4.4.4 the component no longer updates (render
, shouldComponentUpdate
, componentWillReceiveProps
are not called) on route change.
I’ve specifically checked that it works with <= v4.4.3
and not with >= v4.4.4
.
The essential code of the component is:
class Item extends Component {
static contextTypes = {
router: PropTypes.object
};
render() {
return (
<div>{this.context.router.isActive(this.props.url) ? 'yes' : 'no'}</div>
);
}
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
React-admin - Upgrading to v4 - Marmelab
React-admin v4 now uses a context to keep the app basePath, so the basePath prop is no longer necessary. Every component that received...
Read more >4.4 Nonverbal Communication in Context
Nonverbal communication receives less attention than verbal communication as a part of our everyday lives. Learning more about nonverbal communication and ...
Read more ><uses-sdk> | Android Developers
Lets you express an application's compatibility with one or more versions of the Android platform, by means of an API Level integer.
Read more >Links must have discernible text | Axe Rules - Deque University
Ensure that all link names are accessible. · Ensure all links can receive programmatic focus; for example, avoid device-specific events (for example, onmouseover...
Read more >4.4 Existence of a significant financing component
A significant financing component may exist in an arrangement when a customer makes an advance payment because the reporting entity requires ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@landabaso React Redux only uses context for dependency injection of the
store
. The future updates work becauseChild
subscribes to thestore
directly viastore.subscribe()
API.@krukid I sent a few PRs to fix this in React Router, and it won’t be an issue in 3.0 anymore.
Sorry but 2.4.0 had no relation to this issue.
withRouter
that was added there just exposes context as a prop but it doesn’t affect how that context is actually updated.https://github.com/reactjs/react-router/issues/470 is still open. This is the issue you want to be tracking.
I documented a workaround above. Please don’t “suffer”, just use
{ pure: false }
in the meantime. This is exactly why it was added.