Skip to content

[APIVIew UI] Show Comment Counts#14823

Open
smw-ms wants to merge 5 commits intoAzure:mainfrom
smw-ms:apiview/show-comment-counts
Open

[APIVIew UI] Show Comment Counts#14823
smw-ms wants to merge 5 commits intoAzure:mainfrom
smw-ms:apiview/show-comment-counts

Conversation

@smw-ms
Copy link
Copy Markdown
Member

@smw-ms smw-ms commented Mar 31, 2026

Resolves: #14177

The comments are numbered relative to the current set of active (unresolved) threads in navigation order, so if you resolve a comment the numbers change accordingly. That’s why I didn’t add a comment number to the comment header or in the Comments tab. Thoughts?

image

Copilot AI review requested due to automatic review settings March 31, 2026 01:01
Copy link
Copy Markdown
Contributor

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 updates the APIView ClientSPA review experience to show “current of total” counts for unresolved comment-thread navigation, addressing the usability gap described in #14177.

Changes:

  • Adds comment navigation state propagation from CodePanelComponentReviewPageComponentReviewToolbarComponent to display “X of Y” in the toolbar.
  • Adds per-thread “X of Y” display next to the in-thread comment navigation controls.
  • Adjusts styling to support always-visible in-thread navigation controls and new pointer UI.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/dotnet/APIView/ClientSPA/src/app/_components/shared/comment-thread/comment-thread.component.ts Adds inputs to receive thread position and total active-thread count.
src/dotnet/APIView/ClientSPA/src/app/_components/shared/comment-thread/comment-thread.component.html Renders the “X of Y” pointer between prev/next buttons for thread navigation UI.
src/dotnet/APIView/ClientSPA/src/app/_components/shared/comment-thread/comment-thread.component.scss Adds styling for the in-thread navigation pointer.
src/dotnet/APIView/ClientSPA/src/app/_components/review-toolbar/review-toolbar.component.ts Adds inputs for current/total comment navigation state.
src/dotnet/APIView/ClientSPA/src/app/_components/review-toolbar/review-toolbar.component.html Displays “X of Y” in the toolbar comment nav section.
src/dotnet/APIView/ClientSPA/src/app/_components/review-toolbar/review-toolbar.component.scss Styles the toolbar comment nav info text.
src/dotnet/APIView/ClientSPA/src/app/_components/review-page/review-page.component.ts Stores comment navigation state and updates it via a new handler.
src/dotnet/APIView/ClientSPA/src/app/_components/review-page/review-page.component.html Wires the new navigation-state output from code panel into the review page and passes state to the toolbar.
src/dotnet/APIView/ClientSPA/src/app/_components/code-panel/code-panel.component.ts Computes active unresolved-thread positions/count and emits navigation state.
src/dotnet/APIView/ClientSPA/src/app/_components/code-panel/code-panel.component.html Passes computed thread position/count into each comment-thread instance.
src/dotnet/APIView/ClientSPA/src/app/_components/code-panel/code-panel.component.scss Makes in-thread comment navigation controls always visible for comment-thread rows.

Comment on lines +160 to +164
private getActiveCommentThreadPositionData(): { count: number; byRowIndex: Map<number, number> } {
const byRowIndex = new Map<number, number>();
let position = 0;

for (let i = 0; i < this.codePanelRowData.length; i++) {
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

getActiveCommentThreadPositionData() rebuilds the active-thread index map by scanning the full codePanelRowData array each time it's called. Because getActiveCommentThreadPosition()/getActiveCommentThreadCount() are invoked from the template, this can turn into O(n²) work during change detection on large reviews. Consider caching the computed count/map (and re-computing only when comment-thread resolved state / thread rows change), and avoid indexOf(item) by using the row index already available from *uiScroll.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Adding caching complicates the code a bit.

Realistic scenario for noticeable lag:

Review with ~3,000-5,000 total code lines + comments
User rapidly navigating between 20+ unresolved comment threads

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you test the performance on a big review with a ton of comments like:

I know it is not the most common scenario but big reviews, especially with a lot of comments, are always problematic and people is always reaching out to us about them, so just to double check

@tjprescott
Copy link
Copy Markdown
Member

Resolves: #14177

The comments are numbered relative to the current set of active (unresolved) threads in navigation order, so if you resolve a comment the numbers change accordingly. That’s why I didn’t add a comment number to the comment header or in the Comments tab. Thoughts?

image

Two things:

  1. for the text in the upper bar, putting it to the right is going to strain the available horizontal space on certain reviews on smaller screens. Can we put the text underneath "Comment Nav" in a smaller font (so as not to bloat the vertical spacing)?

  2. Instead of the inline counter, what if we put the count in the header of the comment? This actually could resolve my first comment too.

So instead of "Comment on line 344" it would say "Comment on line 344 (4 of 22)"

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.

[APIView UI] Show comment counts

4 participants