Skip to content

Block editor crashes when using thousands of reusable blocks #31442

@mishterk

Description

@mishterk

Description

When working with large numbers of reusable blocks (thousands), the editor crashes the browser when attempting to access the Reusable tab in the block inserter. I know the number of blocks might seem excessive but we have a large sized site with a lot of content that needs to be distributed across products and post types so we'll need to be able to use many thousands of reusable blocks to keep management of the content sane. 😅

Step-by-step reproduction instructions

  1. Create a reusable block
  2. Create 3000 clones of it using the function in this Gist. May need to do this in batches of 1000.
  3. Create a new page/post and open the inserter using the add block "+" icon in the top left corner.
  4. Wait while the Reusable tab appears (this takes a while).
  5. Click on the Reusable tab — this is where the browser tab crashes.

Expected behaviour

I would have expected the reusable block system not to attempt to load all reusable blocks on page load but instead, use an AJAX-based system that shows paginated result sets.

Actual behaviour

The browser appears to attempt to load all reusable blocks on page load, 100 at a time until it eventually hits a RangeError (see screenshot below).

Screenshots or screen recording (optional)

What I'm seeing in Chrome dev tools:
CleanShot 2021-05-04 at 08 58 30@2x

The browsers eventual response:
CleanShot 2021-05-04 at 09 02 56@2x

WordPress information

  • WordPress version: 5.7.1
  • Gutenberg version: Plugin not installed — using core version.
  • Are all plugins except Gutenberg deactivated? Yes.
  • Are you using a default theme (e.g. Twenty Twenty-One)? Was using a bare-bones/empty theme but problem also occurs on Twenty Twenty-One.

Device information

  • Device: MacBook Pro (2017, 3.1 GHz Quad-Core Intel Core i7, 16 GB 2133 MHz LPDDR3)
  • Operating system: macOSS Catalina version 10.15.7
  • Browser: Crome Version 90.0.4430.93 (Official Build) (x86_64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Synced PatternsRelated to synced patterns (formerly reusable blocks)[Type] BugAn existing feature does not function as intended[Type] PerformanceRelated to performance efforts

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions