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

Fix Text nodes being re-rendered unnecessarily #2215

Merged
merged 2 commits into from Dec 30, 2019

Conversation

developit
Copy link
Member

During hydration, we always diff against an empty object as a stand-in for the old VNode. This means newVNode.props is never equal to oldVNode.props. However, hydration should never produce DOM mutations.

This PR addresses the newProps !== oldProps false positive by bypassing Text updates during hydration. It also adds an additional safeguard because in practise I've been seeing Text updates where the new text is exactly the same as the text contents present in the DOM tree. Assuming this happens reasonably often, it's cheaper to check for equality than it is to invalidate layout.

@coveralls
Copy link

coveralls commented Dec 28, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling 2d9339d on fix-text-always-rerendering into 45328e9 on master.

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.

None yet

4 participants