Skip to content

Commit

Permalink
Be more conservative firing view updates after no-op flush
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed May 31, 2024
1 parent 639fd4d commit 411d10b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/domobserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,10 @@ export class DOMObserver {
}
let startState = this.view.state
let handled = applyDOMChange(this.view, domChange)
// The view wasn't updated
if (this.view.state == startState) this.view.update([])
// The view wasn't updated but DOM/selection changes were seen. Reset the view.
if (this.view.state == startState &&
(domChange.bounds || domChange.newSel && !domChange.newSel.main.eq(this.view.state.selection.main)))
this.view.update([])
return handled
}

Expand Down

0 comments on commit 411d10b

Please sign in to comment.