Repository navigation
Components: Optimize SlotFill rendering to avoid props destructuring - #10921
Merged
Merged
Conversation
daniloercoli
added a commit
that referenced
this pull request
Oct 23, 2018
…rnmobile/fix-validation-errorrs-after-block-splitting * 'master' of https://github.com/WordPress/gutenberg: Add some new url helper functions (#10885) Components: Avoid SlotFill props destructuring (#10921) Update Package Changelogs (#10887) chore(release): publish Update plugin version to 4.1 RC2. (#10893)
antpb
pushed a commit
to antpb/gutenberg
that referenced
this pull request
Oct 26, 2018
This file contains hidden or 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
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.
Related: #5952
This pull request seeks to optimize the rendering of components created through
createSlotFillto avoid an unnecessary props destructuring. These components are considered to be hot code paths, being called upwards of thousands of times in the authoring of one or few paragraphs of text (itself an issue worth exploring).The change is simple; since React considers
childrenas a prop (and, in fact, always normalizes back to a prop anyways), there's no need to extract it separately, and it can be included in the default spread of props.The issue boils down to the effective transpiled output of a destructuring:
childrentreated separatelychildrenincluded in...propsspreadNote in above the iteration which would occur through
_objectWithoutPropertiesin the separate treatment, which is avoided altogether in the implementation proposed here.Testing instructions:
There should be no effective difference in behavior.
Ensure Slot/Fill works as expected (sidebar, toolbars, plugins).