fix(copilot): reliable zoom to changed blocks after diff applied#3011
Merged
waleedlatif1 merged 1 commit intostagingfrom Jan 26, 2026
Merged
fix(copilot): reliable zoom to changed blocks after diff applied#3011waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
6aa53f9 to
f1c1e52
Compare
Contributor
Greptile OverviewGreptile SummaryRefactored the copilot zoom-to-changed-blocks feature from a polling/retry approach to an event-driven two-phase system. Phase 1 records the block IDs to zoom when the diff becomes ready, and Phase 2 waits for
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Copilot
participant Phase1 Effect
participant Ref as pendingZoomBlockIdsRef
participant Phase2 Effect
participant DisplayNodes
participant Viewport
Copilot->>Phase1 Effect: isDiffReady = true
Note over Phase1 Effect: Triggered when diff becomes ready
Phase1 Effect->>Phase1 Effect: Extract changedBlockIds from diffAnalysis
alt Has changed blocks
Phase1 Effect->>Ref: Store Set(changedBlockIds)
Note over Ref: Pending zoom request recorded
else No changed blocks
Phase1 Effect->>Viewport: fitViewToBounds (all nodes)
end
Note over DisplayNodes: React updates displayNodes state
DisplayNodes->>Phase2 Effect: displayNodes updated
Phase2 Effect->>Ref: Read pendingBlockIds
alt No pending zoom
Phase2 Effect->>Phase2 Effect: Return early
else Has pending zoom
Phase2 Effect->>DisplayNodes: Filter for pending nodes
Phase2 Effect->>Phase2 Effect: Check all nodes have valid dimensions
alt All nodes ready
Phase2 Effect->>Ref: Clear pending state (null)
Phase2 Effect->>Viewport: requestAnimationFrame
Viewport->>Viewport: fitViewToBounds(pendingNodes)
Note over Viewport: Zoom to changed blocks
else Nodes not ready yet
Phase2 Effect->>Phase2 Effect: Wait for next displayNodes update
end
end
alt Diff cleared/rejected
Copilot->>Phase1 Effect: isDiffReady = false
Phase1 Effect->>Ref: Clear pending state (null)
Note over Ref: Cancel pending zoom
end
|
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.
Summary
Type of Change
Testing
Tested manually
Checklist