fix: multi-line comments on committed Review-tab files - #234
Merged
Conversation
Selection and comment-from-selection only looked up working-tree hunks, so drag-selecting committed Review-tab lines never expanded and the + button could not open a multi-line composer. Resolve hunks from committedFileHunks as well, and wire committed file comment getters through DiffContentArea. Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Tighten array destructuring for eslint, drop a banned test comment, and align screenshot expectations with the hover-only + button affordance. Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
There was a problem hiding this comment.
Committed Review-tab hunks live in committedFileHunks, not allFileHunks. Drag expansion previously bailed out when the file was missing from the working-tree map.
- Fallback to
committedFileHunksso committed-only files can expand a multi-line selection - When the same path exists in both maps, prefer the map whose anchor line content matches the mouseDown capture — avoids selecting the wrong hunks for overlapping committed/uncommitted rows
- See
useLineSelection.ts
There was a problem hiding this comment.
The Committed section previously stubbed getFileCommentsForFile / getOutdatedCommentsForFile to () => [], so any comments attached to committed files could never render in that section.
- Wire the real getters through now that selection/comment creation can target committed hunks
- Permalink:
DiffContentArea.tsx
There was a problem hiding this comment.
handleAddCommentFromSelection had the same working-tree-only lookup, so even a successful selection couldn't open a multi-line composer on committed hunks.
- Resolve hunks from both maps (same content-based disambiguation as selection)
isCommentOutdatedalso consults committed hunks viaresolveFileHunksso comments on committed lines aren't mis-classified once that map is the source of truth- Permalink:
useComments.ts
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
allFileHunks, so committed-only files never expanded a selection and the+button could not open a multi-line composer.committedFileHunksas well (with content-based disambiguation when a path appears in both maps), and DiffContentArea wires real comment getters for the Committed section.Test plan
ChangesDiffViewer.committed-multiline.test.tsx(highlight + composer on committed hunks)test/integration/review/comments.test.tsxcommitted describescripts/screenshot/specs/committed-multiline-comment.spec.tsx(selection + composer on committed Review tab)tsc