-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Convert tests to react-testing-library, remove enzyme and test-renderer #996
Closed
Commits on Jul 14, 2018
-
fix connected props derived props generation
This commit fixes reduxjs#965 The essence of the problem is that getDerivedStateFromProps is called when the incoming props OR incoming local state changes. So we cannot store anything in state that is needed in shouldComponentUpdate. This commit splits up the tracking of incoming props, incoming store state changes, and removes getDerivedStateFromProps and the usage of local state to store any information. Instead, local state is used as a flag solely to track whether the incoming store state has changed. Since derived props are needed in shouldComponentUpdate, it is generated there and then compared to the previous version of derived props. If forceUpdate() is called, this bypasses sCU, and so a check in render() compares the props that should have been passed to sCU to those passed to render(). If they are different, it generates them just-in-time. To summarize: 1) shouldComponentUpdate is ONLY used to process changes to incoming props 2) runUpdater (renamed to triggerUpdateOnStoreStateChange) checks to see if the store state has changed, and stores the state, then updates the counter in local state in order to trigger a new sCU call to re-generate derived state. Because of these changes, getDerivedStateFromProps and the polyfill are both removed. All tests pass on my machine, but there is at least 1 side effects to the new design: - Many of the tests pass state unchanged to props, and pass this to child components. With these changes, the two updates are processed separately. Props changes are processed first, and then state changes are processed. I updated the affected tests to show that there are "in-between" states where the state and props are inconsistent and mapStateToProps is called with these changes. If the old behavior is desired, that would require another redesign, I suspect.
Configuration menu - View commit details
-
Copy full SHA for aaa0470 - Browse repository at this point
Copy the full SHA aaa0470View commit details -
Configuration menu - View commit details
-
Copy full SHA for 41ff984 - Browse repository at this point
Copy the full SHA 41ff984View commit details
Commits on Jul 16, 2018
-
Configuration menu - View commit details
-
Copy full SHA for 9f44bed - Browse repository at this point
Copy the full SHA 9f44bedView commit details
Commits on Aug 11, 2018
-
Configuration menu - View commit details
-
Copy full SHA for 865cc82 - Browse repository at this point
Copy the full SHA 865cc82View commit details
Commits on Aug 12, 2018
-
Configuration menu - View commit details
-
Copy full SHA for eaa3284 - Browse repository at this point
Copy the full SHA eaa3284View commit details -
Configuration menu - View commit details
-
Copy full SHA for 499aa63 - Browse repository at this point
Copy the full SHA 499aa63View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0e2e194 - Browse repository at this point
Copy the full SHA 0e2e194View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1e0ad89 - Browse repository at this point
Copy the full SHA 1e0ad89View commit details -
Configuration menu - View commit details
-
Copy full SHA for 545f53d - Browse repository at this point
Copy the full SHA 545f53dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5333b40 - Browse repository at this point
Copy the full SHA 5333b40View commit details -
Configuration menu - View commit details
-
Copy full SHA for a47b64c - Browse repository at this point
Copy the full SHA a47b64cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 77d4fa3 - Browse repository at this point
Copy the full SHA 77d4fa3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0f427b5 - Browse repository at this point
Copy the full SHA 0f427b5View commit details -
Configuration menu - View commit details
-
Copy full SHA for b255a46 - Browse repository at this point
Copy the full SHA b255a46View commit details -
Configuration menu - View commit details
-
Copy full SHA for eb960c4 - Browse repository at this point
Copy the full SHA eb960c4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9578017 - Browse repository at this point
Copy the full SHA 9578017View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.