fix(editor-performance): resolve hovered block without per-move layout reflow#2301
Open
requilence wants to merge 2 commits into
Open
fix(editor-performance): resolve hovered block without per-move layout reflow#2301requilence wants to merge 2 commits into
requilence wants to merge 2 commits into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes for the "Editor - performance" area, reviewed for regressions before opening.