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

Editor: Handle block merge in withDispatch callback #12820

Merged
merged 1 commit into from
Dec 21, 2018

Conversation

aduth
Copy link
Member

@aduth aduth commented Dec 12, 2018

Previously: #11899
Related: #11851
Refs #11782

This pull request seeks to refactor the BlockListBlock component to handle merge behaviors in the assigned withDispatch callback. This avoids the need to pass a selector function into the component, introduced in #11899, made possible through enhancements in #11851.

The changes also make small optimization refactorings to avoid generating calls to both getPreviousBlockClientId and getNextBlockClientId on a merge, when only one or the other is necessary depending on directionality of the merge.

Testing instructions:

Verify there are no regressions in the behavior of block merging.

@aduth aduth added [Type] Performance Related to performance efforts [Type] Code Quality Issues or PRs that relate to code quality labels Dec 12, 2018
Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

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

The changes seem fine to me. I did a set of manual tests to the bock merging behaviors and everything seems to work as before.
An end to end test was failing it seems intermittent and not related to the changes, I restarted the tests lets see if we are luckier this time.

const previousBlockClientId = getPreviousBlockClientId( clientId );
const nextBlockClientId = getNextBlockClientId( clientId );
// Do nothing when it's the first block.
if (
Copy link
Member

Choose a reason for hiding this comment

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

Nice refactoring of this logic, the new version is equivalent but simpler.

@youknowriad youknowriad added this to the 4.8 milestone Dec 21, 2018
@youknowriad youknowriad force-pushed the update/block-list-merge-with-dispatch branch from 8cbeeef to b4d532d Compare December 21, 2018 09:38
@youknowriad youknowriad merged commit d97a373 into master Dec 21, 2018
@youknowriad youknowriad deleted the update/block-list-merge-with-dispatch branch December 21, 2018 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality [Type] Performance Related to performance efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants