-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Freeze ROOT_NODES for child wrappers #1811
Merged
ljharb
merged 3 commits into
enzymejs:fix_find_statefulness
from
jgzuke:jgzuke-freeze-root-nodes
Sep 21, 2018
Merged
Freeze ROOT_NODES for child wrappers #1811
ljharb
merged 3 commits into
enzymejs:fix_find_statefulness
from
jgzuke:jgzuke-freeze-root-nodes
Sep 21, 2018
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ljharb how to rerun tests if they seem flaky? |
@jgzuke you should be able to click through to the job and rerun the specific builds that errored; i've just done it for this one. |
ljharb
reviewed
Sep 11, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it could be rebased on top of #1781?
jgzuke
force-pushed
the
jgzuke-freeze-root-nodes
branch
from
September 12, 2018 03:23
616c80c
to
610cc44
Compare
ljharb
reviewed
Sep 12, 2018
ljharb
force-pushed
the
fix_find_statefulness
branch
from
September 19, 2018 22:27
e792c97
to
4dd2780
Compare
ljharb
force-pushed
the
jgzuke-freeze-root-nodes
branch
from
September 21, 2018 20:38
a291614
to
53be3e8
Compare
ljharb
added a commit
that referenced
this pull request
Oct 5, 2018
- [new] `mount`: `.state()`/`.setState()`: allow calling on children (#1802) - [new] `configuration`: add `reset` - [fix] `makeOptions`: ensure that config-level `attachTo`/`hydrateIn` are inherited into wrapper options (#1836) - [fix] `shallow`/`Utils`: call into adapter’s `isCustomComponentElement` if present (#1832) - [fix] `shallow`/`mount`: throw an explicit error when state is null/undefined - [fix] freeze ROOT_NODES for child wrappers (#1811) - [fix] `shallow`: `.parents`: ensure that one `.find` call does not affect another (#1781) - [fix] `mount`: update after `simulateError` (#1812) - [refactor] `mount`/`shallow`: `getElement`: use `this.single` - [deps] update `babel-preset-airbnb`, `chai`, `eslint`, `mocha`, `enzyme-adapter-utils`, `react-is`, `airbnb-js-shims`
This was referenced Oct 5, 2018
13 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes the tests in #1781.
There are a few alternative ways to do fix those tests (and some things wrong with this one)
Solution 1 - This one! Save the original
ROOT
node tree, and use in calls toparents
etcROOT
node tree after rootupdate
.update
s will affect theROOT
node tree but not the saved tree. This is already sort of the case, currently updates to theROOT
(for example setting state) would not affectchildWrapper[NODES]
, but would modifychildWrapper[ROOT][NODES]
. Given that we want child wrappers to be immutable I think this might make the most sense..root().getNodeInternal()
instead ofgetRootNodeInternal()
Solution 2 - On
update
we swap all child wrappersROOT
s to a copy of the old root.Solution 3 - Make child wrappers not able to cause
update
sSolution 4 - Make child wrappers not immutable and update with component updates
@ljharb