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

[Urgent] Performance: don't subscribe all blocks to selected block #2575

Merged
merged 1 commit into from Oct 26, 2023

Conversation

ellatrix
Copy link
Contributor

@ellatrix ellatrix commented Oct 23, 2023

Description

Coblocks extends all blocks (through the editor.BlockListBlock filter) with a withSelect HoC, subscribing all blocks to the currently selected block. This means that on typing, the selected block updates, and all blocks on the page re-render because they are all subscribed to changes to the selected block.

I went through all functions in addAllEditorProps to which props is being passed to, but none of them seem to be using props.selected, so it looks like this subscription can be removed without further changes.

Screenshots

Types of changes

Use the React Dev Tools and enable highlight on re-render. Type in a block and watch all blocks re-render.

image

How has this been tested?

Acceptance criteria

Checklist:

  • My code is tested
  • My code follows accessibility standards
  • My code has proper inline documentation
  • I've included any necessary tests
  • I've included developer documentation
  • I've added proper labels to this pull request

@AnthonyLedesma AnthonyLedesma added this to the Next Release milestone Oct 23, 2023
Copy link
Member

@AnthonyLedesma AnthonyLedesma left a comment

Choose a reason for hiding this comment

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

Excellent find. Thank you so much for looking into this issue!

@AnthonyLedesma AnthonyLedesma merged commit 6b1f3fd into godaddy-wordpress:master Oct 26, 2023
201 checks passed
@ellatrix ellatrix deleted the fix/perf-issue branch November 3, 2023 15:14
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

2 participants