Skip to content

Rich Text: Only run the autocomplete for the selected field - #85570

Closed
youknowriad wants to merge 1 commit into
trunkfrom
perf/rich-text-selected-only-hooks
Closed

youknowriad wants to merge 1 commit into
trunkfrom
perf/rich-text-selected-only-hooks

Conversation

@youknowriad

Copy link
Copy Markdown
Contributor

What?

Only the selected rich text field runs the autocomplete. Every other field skips its hook, effects, keydown listener and completers. The field's markup and the autocomplete's behavior are unchanged.

This is a first step in reducing the per-field cost of RichText, which dominates rendering long posts.

Why?

Every block's rich text field mounts the full RichTextWrapper: about 100 hooks and 26 effects per field on trunk. With 1,234 fields in the large post used by the performance tests, that is most of the cost of rendering the blocks. A prototype that rendered unselected fields as static HTML (keeping them contenteditable) put an upper bound of roughly 60ms on what reducing this per-field cost could gain for the first block metric there.

Part of it is machinery that only matters for the selected field. The autocomplete is the clearest case: completions are only offered while typing in a field, which is then the selected one.

How?

The autocomplete (useBlockEditorAutocompleteProps) and the effect mirroring its ARIA attributes onto an editing host move into a SelectedFieldAutocomplete component.

  • It renders only while the field is selected, as a child of the field element: that's where the autocomplete popover already rendered, so its position in the React tree is the same.
  • It attaches to the field by calling the autocomplete's ref with the element in a layout effect. Its capture-phase keydown listener is therefore registered at the same point relative to the other field listeners as before: after the rich text package's, before the block editor's selected-only ones.
  • It hands the ARIA attributes (aria-autocomplete, aria-haspopup, aria-controls, aria-owns, aria-activedescendant) back to RichTextWrapper. The wrapper spreads them on the field where the autocomplete props were spread, so React still renders them, in the same commit as the popover.

Mounting on selection rather than with the field changes nothing visible:

  • useAutocompleteProps only shows the popover and the ARIA attributes after the text changes, and a freshly mounted autocomplete starts from the current value, so nothing opens on selection.
  • Its keydown handling does nothing until the popover has listed options, which only happens after typing.

Not moved, because they don't only matter for the selected field:

  • useMarkPersistent also marks changes made from outside a field (formatting across multi-selected blocks, undo), and would cancel a pending typing debounce on deselection.
  • The focus and cross-block selection layout effects must run after useRichText's own layout effects, which a child's effects can't.

Per unselected field, RichTextWrapper goes from 100 hooks and 26 effects to 81 hooks and 23 effects.

On the large performance-test post (1,234 rich text fields), measured locally over 4 interleaved rounds of 10 loads, first block went from 579/577/581/575ms to 569/570/577/574ms: about −5ms, roughly 1%. In CPU profiles, RichTextWrapper drops from ~20.5ms to ~18.2ms per load. The larger gains need lazier activation of the field itself (useRichText and its listeners), which is a bigger change.

Testing Instructions

  1. In a paragraph, type /head: the block list opens, arrow keys move through it, Enter inserts a heading, and Escape dismisses it.
  2. Type @ followed by a user name: the mention list works as before.
  3. While a list is open, the field has aria-autocomplete, aria-haspopup, aria-controls, aria-owns and aria-activedescendant. They are removed when it closes. In a block supporting editableRoot, they are mirrored onto the editing host.

The behavior and resulting content of the slash inserter were identical to trunk in a scripted check. The autocomplete-and-mentions, rich-text, writing-flow, splitting-merging, multi-block-selection, inserting-blocks, footnotes and block-editor-keyboard-shortcuts e2e specs, plus the paragraph, heading, list and quote block specs, pass in Chromium locally. The only failures were two multi-block-selection tests and the "newlines after multiple mention completions" test, which also fail intermittently on trunk locally.

Use of AI Tools

Profiled, implemented and measured with Claude Code (Claude Opus 5.5).

🤖 Generated with Claude Code

Completions are only offered while typing in a field, which is then the
selected field, yet every rich text field ran the autocomplete hook, its
effects and keydown listener, and the effect mirroring its ARIA attributes.
Move them into a component that renders as the field's child, where the
autocomplete popover rendered, only while the field is selected. It attaches
to the field as its ref did, and hands the ARIA attributes back to the field
to render, so the field's markup is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@youknowriad
youknowriad requested a review from ellatrix as a code owner October 26, 2026 16:25
@youknowriad youknowriad added [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Type] Performance Related to performance efforts [Package] Block editor /packages/block-editor labels Oct 26, 2026
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: youknowriad <youknowriad@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: -587 B (-0.01%)

Total Size: 8.55 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 541 kB +77 B (+0.01%)
build/scripts/edit-site/index.min.js 376 kB -99 B (-0.03%)
build/scripts/editor/index.min.js 555 kB -153 B (-0.03%)
build/scripts/media-utils/index.min.js 231 kB -136 B (-0.06%)
build/styles/edit-site/style-rtl.css 20.5 kB -55 B (-0.27%)
build/styles/edit-site/style-rtl.min.css 16.6 kB -14 B (-0.08%)
build/styles/edit-site/style.css 20.5 kB -55 B (-0.27%)
build/styles/edit-site/style.min.css 16.6 kB -14 B (-0.08%)
build/styles/editor/style-rtl.css 30.1 kB -54 B (-0.18%)
build/styles/editor/style-rtl.min.css 25.8 kB -16 B (-0.06%)
build/styles/editor/style.css 30.1 kB -53 B (-0.18%)
build/styles/editor/style.min.css 25.8 kB -15 B (-0.06%)

29d174f Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric f765592 trunk % Change
timeToFirstByte 35.45 ms +7.05% -6.35% 34.35 ms +20.52% -2.47% 3.2%
largestContentfulPaint 64 ms +3.13% -6.25% 64 ms +6.25% -6.25% 0%
lcpMinusTtfb 25.95 ms +7.51% -5.97% 26.15 ms +14.72% -8.99% -0.76%
wpBeforeTemplate 18.21 ms +20.65% -2.09% 18.12 ms +23.29% -1.55% 0.5%
wpTemplate 12.86 ms +13.14% -7% 12.99 ms +6.62% -2.93% -1%
wpTotal 32.57 ms +6.79% -7.37% 31.43 ms +19.47% -2.8% 3.63%
wpMemoryUsage 7.68 MB +0% -0% 7.65 MB +0% -0% 0.43%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric f765592 trunk % Change
timeToFirstByte 29.9 ms +8.86% -3.68% 28.95 ms +10.19% -1.04% 3.28%
largestContentfulPaint 68 ms +5.88% -0% 68 ms +2.94% -2.94% 0%
lcpMinusTtfb 39.3 ms +1.02% -1.65% 39.05 ms +1.41% -9.22% 0.64%
wpBeforeTemplate 16.49 ms +14.37% -0.91% 16.38 ms +18.74% -1.59% 0.67%
wpTemplate 10.13 ms +5.23% -1.58% 10.02 ms +4.99% -1.8% 1.1%
wpTotal 27.24 ms +8.92% -3.34% 26.44 ms +10.78% -1.1% 3.03%
wpMemoryUsage 6.37 MB +0% -0% 6.34 MB +0% -0% 0.53%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric f765592 trunk % Change
mediaProcessingJpeg 233.66 ms +1.65% -1.36% 232.11 ms +6.04% -2.5% 0.67%
mediaProcessingAvif 3826.94 ms +0.48% -0.17% 3765.65 ms +0.29% -0.15% 1.63%
mediaProcessingJpegToAvif 2617.2 ms +0.07% -0.82% 2646.83 ms +0.31% -0.71% -1.12%

media-upload

Metric f765592 trunk % Change
jpegUploadProcessing 912.75 ms +5.25% -2.98% 887.33 ms +1.38% -1.13% 2.86%
pngUploadProcessing 171.37 ms +5.55% -3.97% 170.37 ms +0.83% -2.36% 0.59%
largeJpegUploadProcessing 895.54 ms +0.7% -0.55% 895.72 ms +0.36% -0.4% -0.02%
multipleImageUploadProcessing 1007.8 ms +1.97% -1.44% 1001.93 ms +15.7% -2.75% 0.59%

post-editor

Metric f765592 trunk % Change
serverResponse 416.23 ms +1.21% -7.83% 403.43 ms +6.56% -4.56% 3.17%
firstPaint 479.62 ms +9.49% -35.36% 451.35 ms +8.52% -14.24% 6.26%
domContentLoaded 868.53 ms +1.65% -0.47% 857.77 ms +1.46% -1.52% 1.25%
loaded 869.82 ms +1.61% -0.5% 859.11 ms +1.42% -1.55% 1.25%
firstContentfulPaint 507.15 ms +3.87% -8.52% 483.82 ms +7.89% -11.87% 4.82%
firstBlock 2871.57 ms +2.99% -1.08% 2875.47 ms +2.25% -0.88% -0.14%
type 19.13 ms +15.58% -6.27% 17.45 ms +1.72% -0.92% 9.63%
typeWithoutInspector 18.69 ms +3.32% -6.85% 18.35 ms +9.54% -2.62% 1.85%
typeWithTopToolbar 23.78 ms +3.74% -5% 23.98 ms +8.59% -3.96% -0.83%
typeContainer 8.2 ms +7.8% -6.59% 8.33 ms +3.48% -6.12% -1.56%
focus 117.67 ms +2.55% -6.02% 115.87 ms +2.79% -5.79% 1.55%
firstFocus 212.24 ms +0% -0% 225.65 ms +0% -0% -5.94%
selectAll 480.36 ms +0.81% -1.01% 459.07 ms +0.58% -1.8% 4.64%
listViewOpen 76.29 ms +7.27% -10.16% 72.72 ms +22.08% -6.6% 4.91%
inserterOpen 42.93 ms +11.97% -11.06% 39.84 ms +19.5% -4.79% 7.76%
inserterHover 11.52 ms +7.03% -5.56% 12.16 ms +4.52% -9.95% -5.26%
inserterSearch 9.18 ms +1.63% -14.49% 8.92 ms +12.44% -5.94% 2.91%
loadPatterns 655.55 ms +1.59% -7.87% 637.59 ms +5.03% -2.95% 2.82%
wpTotal 405.73 ms +1.05% -8.14% 392.63 ms +6.85% -4.69% 3.34%
wpMemoryUsage 14.71 MB +0% -0% 14.68 MB +0% -0% 0.24%
wpDbQueries 55 +0% -1.82% 55 +0% -1.82% 0%

site-editor

Metric f765592 trunk % Change
serverResponse 480.09 ms +6.64% -1.6% 486.33 ms +3.65% -4.74% -1.28%
firstPaint 239.7 ms +14.19% -9.58% 253.8 ms +6.51% -3.53% -5.56%
domContentLoaded 883.42 ms +0.55% -1.63% 878.72 ms +1.29% -0.67% 0.53%
loaded 884.54 ms +0.53% -1.64% 879.8 ms +1.28% -0.69% 0.54%
firstContentfulPaint 482.01 ms +5% -3.78% 492.54 ms +1.91% -22.31% -2.14%
firstBlock 4075.31 ms +0.67% -1.19% 4067.02 ms +0.83% -0.75% 0.2%
type 16.45 ms +4.68% -3.4% 16.99 ms +4.12% -3.47% -3.18%
navigate 106.98 ms +9.19% -4.12% 121.04 ms +7.68% -5.77% -11.62%
loadPatterns 1094.62 ms +5.51% -6.07% 1200.63 ms +6.36% -12.09% -8.83%
loadPages 954.61 ms +1.72% -2.83% 951.78 ms +3.6% -2.73% 0.3%
wpTotal 470.27 ms +6.83% -1.53% 476.78 ms +3.83% -4.85% -1.37%
wpMemoryUsage 12.73 MB +0% -0% 12.70 MB +0% -0% 0.24%
wpDbQueries 44 +2.27% -0% 44 +2.27% -0% 0%

29d174f Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

Backspace in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  -  5
+ Received  + 11

@@ -1,25 +1,31 @@
  Array [
    Object {
      "innerBlocks": Array [
        Object {
          "attributes": Object {
-           "content": "1",
+           "content": "1‸a",
          },
-         "innerBlocks": Array [
+         "innerBlocks": Array [],
+         "name": "core/list-item",
+       },
        Object {
+         "attributes": Object {
+           "content": "2",
+         },
          "innerBlocks": Array [
            Object {
              "attributes": Object {
-                   "content": "a‸2",
+               "ordered": false,
+               "values": "",
              },
-                 "name": "core/list-item",
-               },
+             "innerBlocks": Array [
                Object {
                  "attributes": Object {
                    "content": "b",
                  },
+                 "innerBlocks": Array [],
                  "name": "core/list-item",
                },
              ],
              "name": "core/list",
            },

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:2041:42
Custom Completer: should allow newlines after multiple option completions in /test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,11 +1,11 @@
  <!-- wp:paragraph -->
  <p>🫐 test</p>
  <!-- /wp:paragraph -->

  <!-- wp:paragraph -->
- <p>🫐 test</p>
+ <p>🍎 test</p>
  <!-- /wp:paragraph -->

  <!-- wp:paragraph -->
  <p>🫐 test</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js:466:6
Custom Completer: should not insert disabled options in /test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

  <!-- wp:paragraph -->
- <p>Sorry, we are all out of ~g grapes.</p>
+ <p>Sorry, we are all out of 🍎 grapes.</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js:391:7
Navigates the items list via UP/DOWN arrow keys (Site Editor v2) in /test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  getByLabel('Page One')
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" getByLabel('Page One') with timeout 5000ms
  - waiting for getByLabel('Page One')
    14 × locator resolved to <button type="button" aria-pressed="true" data-active-item="true" id="view-list-0-12-item-wrapper" class="dataviews-view-list__item" aria-labelledby="view-list-0-12-label" aria-describedby="view-list-0-12-description"></button>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js:149:49
Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 6,
+   "offset": 6,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
can apply custom gradient background color in /test/e2e/specs/editor/blocks/buttons.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

  <!-- wp:buttons -->
- <div class="wp-block-buttons"><!-- wp:button {"style":{"background":{"gradient":"linear-gradient(135deg,rgb(255,0,0) 0%,rgb(0,255,0) 100%)"}}} -->
+ <div class="wp-block-buttons"><!-- wp:button {"style":{"background":{"gradient":"linear-gradient(135deg,rgb(6,147,227) 0%,rgb(0,255,0) 100%)"}}} -->
  <div class="wp-block-button"><a class="wp-block-button__link wp-element-button">Content</a></div>
  <!-- /wp:button --></div>
  <!-- /wp:buttons -->
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/buttons.spec.js:411:21
can be converted to paragraphs in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

  <!-- wp:paragraph -->
- <p>one</p>
+ <p>ne</p>
  <!-- /wp:paragraph -->

  <!-- wp:paragraph -->
  <p>two</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:391:52
can be converted when nested to paragraphs in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('role=toolbar[name="Block tools"i]').locator('role=button[name="Indent"]')

    at Editor.clickBlockToolbarButton (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/click-block-toolbar-button.ts:17:15)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:410:3
does not select blocks in the canvas preview when editing from the sidebar in /test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator: getByRole('combobox', { name: 'Search or type URL' })
Expected: focused
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeFocused" getByRole('combobox', { name: 'Search or type URL' }) with timeout 5000ms
  - waiting for getByRole('combobox', { name: 'Search or type URL' })

    at LinkControl.useLinkControlSearch (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:416:47)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:179:21
inserts a block should show a blue line indicator in /test/e2e/specs/editor/various/inserting-blocks.spec.js, passed after 1 failed attempt.
TypeError: Cannot read properties of null (reading 'y')
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/inserting-blocks.spec.js:681:32
should create paragraph on split at end and merge back with content in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,8 +1,8 @@
  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>one</li>
+ <li>ne</li>
  <!-- /wp:list-item --></ul>
  <!-- /wp:list -->

  <!-- wp:paragraph -->
  <p></p>

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:461:52
should cut and paste individual blocks with collapsed selection in /test/e2e/specs/editor/various/copy-cut-paste.spec.js, passed after 1 failed attempt.
Error: expect(string).toMatchSnapshot(expected) failed

  @@ -1,3 +1,3 @@
   <!-- wp:paragraph -->
  -<p>2Cut - collapsed selection</p>
  +<p>2</p>
   <!-- /wp:paragraph -->


    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/copy-cut-paste.spec.js:45:49
should indent and outdent multi-selected items with Tab in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,8 +1,8 @@
  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>one<!-- wp:list -->
+ <li>ne<!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
  <li>two</li>
  <!-- /wp:list-item -->

  <!-- wp:list-item -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:1118:52
should insert a line break on shift+enter in a non trailing list item in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 10
+ Received  + 10

  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>a</li>
+ <li></li>
- <!-- /wp:list-item -->
-
+ <!-- /wp:list-item --></ul>
- <!-- wp:list-item -->
+ <!-- /wp:list -->
+
+ <!-- wp:paragraph -->
- <li>b<br></li>
+ <p>b<br></p>
- <!-- /wp:list-item -->
+ <!-- /wp:paragraph -->

- <!-- wp:list-item -->
+ <!-- wp:paragraph -->
- <li>c</li>
+ <p>c</p>
- <!-- /wp:list-item --></ul>
- <!-- /wp:list -->
+ <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:1233:52
should insert a line break on shift+enter in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>a<br></li>
+ <li><br></li>
  <!-- /wp:list-item --></ul>
  <!-- /wp:list -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:1210:52
should keep the list type when indenting an ordered list item in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,8 +1,8 @@
  <!-- wp:list {"ordered":true} -->
  <ol class="wp-block-list"><!-- wp:list-item -->
- <li>one<!-- wp:list {"ordered":true} -->
+ <li>ne<!-- wp:list {"ordered":true} -->
  <ol class="wp-block-list"><!-- wp:list-item -->
  <li>two</li>
  <!-- /wp:list-item --></ol>
  <!-- /wp:list --></li>
  <!-- /wp:list-item --></ol>

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:916:52
should leave nested list intact when deleting the parent item in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  -  0
+ Received  + 13

@@ -3,17 +3,29 @@
      "innerBlocks": Array [
        Object {
          "attributes": Object {
            "content": "1",
          },
+         "innerBlocks": Array [],
+         "name": "core/list-item",
+       },
+       Object {
+         "attributes": Object {
+           "content": "",
+         },
          "innerBlocks": Array [
            Object {
+             "attributes": Object {
+               "ordered": false,
+               "values": "",
+             },
              "innerBlocks": Array [
                Object {
                  "attributes": Object {
                    "content": "a",
                  },
+                 "innerBlocks": Array [],
                  "name": "core/list-item",
                },
              ],
              "name": "core/list",
            },
@@ -22,10 +34,11 @@
        },
        Object {
          "attributes": Object {
            "content": "3",
          },
+         "innerBlocks": Array [],
          "name": "core/list-item",
        },
      ],
      "name": "core/list",
    },
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:3017:38
should leave the rest of the list intact when merging into an empty list item in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  -  0
+ Received  + 13

Truncated. See the full report.

29d174f Run

@Mamaduka

Copy link
Copy Markdown
Member

I think Ella tried something similar in #78304.

@youknowriad
youknowriad deleted the perf/rich-text-selected-only-hooks branch October 26, 2026 17:13
@youknowriad

Copy link
Copy Markdown
Contributor Author

This did produce a result. 2% improvement in block mounting but it's small so not sure worth the weird pattern (sub component that calls a state on the parent component)

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

Labels

[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Package] Block editor /packages/block-editor [Type] Performance Related to performance efforts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants