-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks promising.
2aeef3e
to
386a7d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
trunk
as well.How has this been tested?
Screenshots
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).