Block editor: async mode: enable only for blocks out of view#30995
Block editor: async mode: enable only for blocks out of view#30995
Conversation
| multiSelectedBlockClientIds, | ||
| hasMultiSelection, | ||
| } = useSelect( selector, [ rootClientId ] ); | ||
| const intersectingBlocks = useContext( IntersectingBlocks ); |
There was a problem hiding this comment.
This will be a set of a small number of client IDs that are in view.
| // This prop is explicitely computed and passed down | ||
| // to avoid being impacted by the async mode | ||
| // otherwise there might be a small delay to trigger the animation. | ||
| index={ index } |
There was a problem hiding this comment.
I wonder if we still need this when all blocks in view are updated synchronously.
|
Size Change: +207 B (0%) Total Size: 1.3 MB
ℹ️ View Unchanged
|
| key={ clientId } | ||
| value={ | ||
| ! intersectingBlocks.has( clientId ) && | ||
| ! selectedBlocks.has( clientId ) |
There was a problem hiding this comment.
Leaving a check for selected blocks because I see some e2e test failures that I think come from a selected block being edited that is out of view.
youknowriad
left a comment
There was a problem hiding this comment.
this looks promising.
2aeef3e to
386a7d6
Compare
youknowriad
left a comment
There was a problem hiding this comment.
There are some failing tests that are worth checking. But this looks good to me.
|
Yeah there's a failing test that I can't figure out atm. I'll need to have a fresh look next week I think. |
386a7d6 to
c3947bd
Compare
|
I think this is solid. Let's try it. |
Description
Fixes #30249.
Fixes #30299.
Right now we prioritise select calls for selected blocks. This PR explores prioritising (disabling async mode) select calls for all blocks that are visible on the screen.
I'd expect there to be a small performance hit for typing, but the absolute increase should be the same for both small and large posts.
I tested a large post and I didn't really notice a difference. Perhaps the first character typed felt a bit slower (when typing mode get enabled and toolbars disappear), but I'm not sure without more testing. There's a delay for the first character in
trunkas well.How has this been tested?
Screenshots
Types of changes
Checklist:
*.native.jsfiles for terms that need renaming or removal).