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

Optimize the insertion point component #12384

Merged
merged 1 commit into from Nov 30, 2018

Conversation

Projects
None yet
3 participants
@youknowriad
Copy link
Contributor

youknowriad commented Nov 28, 2018

This PR avoids calling the getBlock selector in the InsertionPoint component. I'm not really certain why this call was necessary. It doesn't seem to harm the experience in my testing.

This is a 6% performance improvement when typing.

@youknowriad youknowriad requested review from sgomes , aduth and WordPress/gutenberg-core Nov 28, 2018

const showInsertionPoint = (
isBlockInsertionPointVisible() &&
insertionPoint.index === insertIndex &&
insertionPoint.rootClientId === rootClientId &&
! isUnmodifiedDefaultBlock( block )

This comment has been minimized.

@youknowriad

youknowriad Nov 28, 2018

Contributor

This basically says, we don't show the insertion point indicator if the block is empty (empty paragraph block). I don't really understand why personally in addition to the fact that it harms the performance. @jasmussen Thoughts on that? How does the insertion indicator works on this PR for you?

@aduth

aduth approved these changes Nov 28, 2018

@youknowriad youknowriad merged commit 5216124 into perf/avoid-previous-block-selector Nov 30, 2018

@youknowriad youknowriad deleted the update/optimize-insertion-point branch Nov 30, 2018

youknowriad added a commit that referenced this pull request Nov 30, 2018

Avoid rerending the current block if the previous block change (#12379)
* Avoid rerending the current block if the previous block change

* Always show the sibling inserter

* Optimize the insertion point component (#12384)

youknowriad added a commit that referenced this pull request Nov 30, 2018

Avoid rerending the current block if the previous block change (#12379)
* Avoid rerending the current block if the previous block change

* Always show the sibling inserter

* Optimize the insertion point component (#12384)

youknowriad added a commit that referenced this pull request Nov 30, 2018

Avoid rerending the current block if the previous block change (#12379)
* Avoid rerending the current block if the previous block change

* Always show the sibling inserter

* Optimize the insertion point component (#12384)

youknowriad added a commit that referenced this pull request Nov 30, 2018

Avoid getBlock in block-list/block (#11899)
* Avoid getBlock in block-list/block

* Update data docs

* Fix unit tests post rebase :)

* Rename props

* Clarify the filter position

* Avoid repeating the selector dependants

* Fix small typo in the docs

* Avoid rerending the current block if the previous block change (#12379)

* Avoid rerending the current block if the previous block change

* Always show the sibling inserter

* Optimize the insertion point component (#12384)

* Fix lock file

* Fix linting

grey-rsi pushed a commit to OnTheGoSystems/gutenberg that referenced this pull request Jan 4, 2019

Avoid getBlock in block-list/block (WordPress#11899)
* Avoid getBlock in block-list/block

* Update data docs

* Fix unit tests post rebase :)

* Rename props

* Clarify the filter position

* Avoid repeating the selector dependants

* Fix small typo in the docs

* Avoid rerending the current block if the previous block change (WordPress#12379)

* Avoid rerending the current block if the previous block change

* Always show the sibling inserter

* Optimize the insertion point component (WordPress#12384)

* Fix lock file

* Fix linting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment