Skip to content
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

Proper children reconcile for nested tags #871

Merged
merged 1 commit into from
Feb 25, 2018
Merged

Conversation

theKashey
Copy link
Collaborator

Proper children reconcile for nested tags, fixes #869

The way a change the tests indicates that problem was fixed.

@@ -129,17 +129,19 @@ const mapChildren = (children, instances) => ({
}
}

const newChildren = asArray((child.props && child.props.children) || [])
const newChildren = asArray(
(child.props && child.props.children) || child.children || [],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When result of this function on next render iteration got in here again - it will be just ignored.
That was the first problem.

// the children from an instance or rendered children
// while children from a props is just a props.
// they could not exists. they could differ.
...(nextChildren ? { children: nextChildren } : {}),
...(nextChildren || {}),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a second. A little "gap" in the tree

@@ -213,12 +213,50 @@ describe('reconciler', () => {

incrementGeneration()
wrapper.setProps({ update: 'now' })
expect(First.rendered).toHaveBeenCalledTimes(4)
expect(First.rendered).toHaveBeenCalledTimes(3)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means - fixed!

@codecov-io
Copy link

Codecov Report

Merging #871 into next will increase coverage by 0.15%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next     #871      +/-   ##
==========================================
+ Coverage   87.22%   87.38%   +0.15%     
==========================================
  Files          30       30              
  Lines         634      634              
  Branches      149      148       -1     
==========================================
+ Hits          553      554       +1     
+ Misses         65       64       -1     
  Partials       16       16
Impacted Files Coverage Δ
src/reconciler/hotReplacementRender.js 85.31% <100%> (+0.69%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b13ed1...df21426. Read the comment docs.

@gregberge gregberge merged commit 2de4e58 into next Feb 25, 2018
@gregberge gregberge deleted the fix-merge-children branch February 25, 2018 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants