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
Fix getDerivedStateFromProps usage #980
Commits on Jul 21, 2018
-
-
working, except the issue with multiple mapState calls
breaks 3 tests: connect.spec.js: 1. React connect should subscribe properly when a middle connected component does not subscribe 2. React connect should pass state consistently to mapState Provider.spec.js 1. React should pass state consistently to mapState However, it is possible that the tests fail simply because the ORDER has changed? Will test that theory in a moment
Commits on Jul 22, 2018
-
success! gDSFP-based react-redux
The key is that in gDSFP we grab the current store state instead of using our cached value, and it always works, even with batched redux actions. We also use current props instead of cached ones in relevant portions.
-
-
Commits on Jul 24, 2018
-
use polyfill, make peer dependency relaxed
Store last seen props in gDSFP (was an oversight). Does not change behavior, just performance.
Commits on Jul 25, 2018
Commits on Aug 1, 2018
-
move instance props into state
This does not make subscriptions async-safe, because redux uses the subscription to render children. This is an anti-pattern that will need to be fixed in 6.0 when a redesign using the new Context API is done
Commits on Aug 2, 2018
-
In redux 5 and earlier, subscription to the store is done in the constructor, and passed down to children. But in async, it is possible for a render tree to begin, then suspend, then be discarded. In this case, we leak memory from the subscription that was created. This new system postpones the creation of subscription until componentDidMount is called, which is when subscriptions are safe to be made. The principles are gleaned from this gist by bvaughn: https://gist.github.com/bvaughn/d569177d70b50b58bff69c3c4a5353f3
-
async-safe Subscription now works as follows: * on element creation, a Subscription object is initialized, but does not link to anything outside of the current element * after the component tree is rendered, componentDidMount is called * This triggers hydration of the subscription tree, which is ready to subscribe * parent elements create their listener collection, and children subscribe cascading to the bottom of the element tree
-
update subscription change check to be accurate
This needs to check whether notifyNestedSubs has changed, not subscription, now that subscription is set in the constructor and only changes its internals when it is safe.
Commits on Aug 3, 2018
-
-
-
-
-
in order to handle subscriptions in state, we have to treat React 16.4 differently from 16.3, because state changes trigger gDSFP in 16.4 and don't in 16.3-
-
Also improves performance it seemed componentDidUpdate was needed to ensure subscriptions work, but this is untrue, and causes infinite loops on pre-React 16