Skip to content

Block Menu: Fix the default render function - #4729

Merged
youknowriad merged 1 commit into
masterfrom
fix/multi-selection-block-menu
Jan 30, 2018
Merged

youknowriad merged 1 commit into
masterfrom
fix/multi-selection-block-menu

Conversation

@youknowriad

Copy link
Copy Markdown
Contributor

Related #4661 (comment)

This PR fixes the block menu when there's a multi-selection.

Testing instructions

  • Select multiple blocks
  • Click the block settings menu (the ... menu)
  • Notice that the "remove" link show up properly.

@youknowriad youknowriad added the [Type] Bug An existing feature does not function as intended label Jan 29, 2018
@youknowriad youknowriad self-assigned this Jan 29, 2018
@youknowriad
youknowriad requested a review from aduth January 29, 2018 09:58

@jorgefilipecosta jorgefilipecosta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 👍 It solves the problem in my tests.

@youknowriad
youknowriad merged commit 3faf9d7 into master Jan 30, 2018
@youknowriad
youknowriad deleted the fix/multi-selection-block-menu branch January 30, 2018 07:40

@aduth aduth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think there's room for a simple performance optimization here, which is to hoist the default as a constant to share the reference across re-renders, rather than creating a new function each time:

const DEFAULT_RENDER_BLOCK_MENU = ( { children } ) => children;

function BlockSettingsMenu( {
	uids,
	onSelect,
	focus,
	renderBlockMenu = DEFAULT_RENDER_BLOCK_MENU,
) {

@youknowriad

Copy link
Copy Markdown
Contributor Author

@aduth Since this change has no effect on the "props" of any rendered element, I don't think it will change anything performance wise

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

Labels

[Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants