Skip to content

fix(editor-performance): resolve hovered block without per-move layout reflow#2301

Open
requilence wants to merge 2 commits into
developfrom
worktree-agent-ab020507efc621aea
Open

fix(editor-performance): resolve hovered block without per-move layout reflow#2301
requilence wants to merge 2 commits into
developfrom
worktree-agent-ab020507efc621aea

Conversation

@requilence

Copy link
Copy Markdown
Contributor

Fixes for the "Editor - performance" area, reviewed for regressions before opening.

  • JS-7379 — Cursor placement on very large documents is no longer slowed by a per-block layout reflow on every mouse move (note: This is a scoped fix (hover hit-test only); the larger block-list virtualization that would fully solve extreme-scale lag was intentionally out of scope for this pass.)

…ring every block (JS-7379)

onMouseMove walked all blocks via S.Block.getBlocks and called
getBoundingClientRect on each to find the hovered block — an O(n)
forced reflow per mouse move that stalls cursor placement on large
documents. Resolve the hovered block by walking up the ancestor chain
from e.target instead: the innermost eligible non-layout block wins,
with the innermost eligible layout block as a fallback (gap between
columns resolves to the row, table internals resolve to the table
block). Dataview blocks keep the 88px top hover zone. Hovering the
floating add button itself now keeps the current hover state, since
the target-based hit test cannot see through the overlay.
…379)

The early-return guard for hovering the floating add button froze
hoverPosition at the last mousemove before entering the button, so the
Top/Bottom insertion decision could disagree with the cursor's visual
position on short blocks. Re-derive it from the cached hovered block's
rect (single rect read, no O(n) cost) inside the guard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant