Skip to content

Implementing two innerBlocks inside a custom block results in shared state between the two components #19793

Closed

Description

Describe the bug
When creating a custom block with two InnerBlocks next to each other they share the same state, duplicate the InspectorControls in the sidebar and cause high CPU load resulting in page lag.

To reproduce
Steps to reproduce the behavior:

  1. Create a block with two InnerBlocks in the Edit Callback
  2. Add the block to a page
  3. Try edit the block, and look at the InspectorControls
  4. Encounter duplicate behavior of the two blocks, both blocks share the same state and the InspectorControls options are duplicated. Also encounter high CPU load and page lag.

Expected behavior
Each InnerBlock to have it own state, a single InspectorControls options for each InnerBlock, normal CPU load and no page lag.

Screenshots
Bug
Bug

Code
bug_code

Desktop:

  • OS: Linux Ubuntu
  • Browser: Firefox

Additional context

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

Metadata

Assignees

No one assigned

    Labels

    [Feature] Nested / Inner BlocksAnything related to the experience of nested/inner blocks inside a larger container, like Group or P[Type] Help RequestHelp with setup, implementation, or "How do I?" questions.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions