Skip to content

Conversation

@amadeus
Copy link
Member

@amadeus amadeus commented Jan 16, 2026

Mostly some prep work for virtualization to reduce dom work if we can

This is generally prep work for virtualization because we now
potentially have noisy dom updates and it's better to not thrash stuff
if we don't need too
@amadeus amadeus requested a review from Copilot January 16, 2026 22:19
@vercel
Copy link

vercel bot commented Jan 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
pierrejs-diff-demo Ready Ready Preview Jan 16, 2026 10:19pm
pierrejs-docs Ready Ready Preview Jan 16, 2026 10:19pm
pierrejs-solid-diff-demo Ready Ready Preview Jan 16, 2026 10:19pm

Request Review

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces performance optimizations to the ScrollSyncManager to reduce unnecessary DOM operations, preparing the codebase for future virtualization work. The changes ensure scroll synchronization is only active when needed and avoid redundant event listener manipulation.

Changes:

  • Added an enabled flag to track ScrollSyncManager state and skip unnecessary cleanup operations
  • Optimized event listener management to only add/remove listeners when DOM element references actually change
  • Made scroll synchronization conditional on diffStyle being 'split', since unified diffs don't require scroll syncing

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/diffs/src/managers/ScrollSyncManager.ts Added enabled flag for state tracking, optimized event listener setup to check for element reference changes, added early return in cleanup when not enabled
packages/diffs/src/components/FileDiff.ts Conditionally setup/cleanup ScrollSyncManager based on whether diffStyle is 'split', ensuring the manager is only active when needed

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@amadeus amadeus merged commit e449124 into main Jan 16, 2026
16 checks passed
@amadeus amadeus deleted the amadeus/scroll-sync-optimization branch January 16, 2026 22:25
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.

2 participants