fix(vscode): prevent preview sync feedback loop - #2680
Merged
antfu merged 2 commits intoJul 31, 2026
Merged
Conversation
✅ Deploy Preview for slidev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
fredcallaway
marked this pull request as ready for review
July 20, 2026 12:16
@slidev/client
create-slidev
create-slidev-theme
@slidev/parser
@slidev/cli
@slidev/types
commit: |
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.
Warning: this is mostly AI-generated (Codex 5.6 Sol Medium). Take or leave as you wish.
I was getting terrible oscillation jitter whenever I progressed through animations with cursor sync on. I confirmed the bad behavior in a fresh slidev project. With the fix, it has been working perfectly.
-- end human generated content --
Summary
Problem
With preview sync enabled,
Slidev: Navigate to next click in preview windowcan oscillate between adjacent slides when the click crosses a slide boundary. The preview moves to slide N+1 and starts focusing that slide in the editor, but the editor's visible range can update before the debounced focused slide does. Because the same watcher observes both values, it sends the stale slide N back to the preview, creating a feedback loop that also moves the cursor repeatedly.The overview viewport is irrelevant in slide mode, and the focused cursor slide is irrelevant in overview mode. Selecting the watched value based on the active preview mode removes the cross-trigger while preserving both sync directions.
Reproduction
Slidev: Navigate to next click in preview window.This also reproduces in a fresh project created with
pnpm create slidev.Validation
pnpm -C packages/vscode buildpnpm typecheckpnpm exec eslint packages/vscode/src/views/previewWebview.ts