Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

Fix PR Node Notification Refresh Issue

The problem: When notifications change, PR nodes don't refresh their tree items to update the context value, causing the "dismiss notification" option to not appear in the context menu until a manual refresh.

Solution:
This PR fixes the bug by adding event listeners in PRNode to monitor notification changes from both NotificationsManager (regular notifications) and PrsTreeModel (Copilot notifications). When a notification affecting a specific PR changes, the node refreshes itself to update its tree item with the correct context value, which controls the visibility of the dismiss notification menu item.

Changes Made:

  • Added registerNotificationChanges() method to PRNode that listens to both regular and Copilot notification changes
  • When notifications change, the method checks if any of the changed notifications affect this specific PR node
  • If a relevant notification change is detected, the node refreshes itself to update the tree item with the correct context value
  • This ensures the :notification suffix is added/removed from the context value dynamically, which controls the visibility of the "dismiss notification" menu item

Testing:

  • ✅ Linters passed
  • ✅ Hygiene checks passed
  • ✅ Code review completed (no issues in implementation)
  • ✅ CodeQL security scan passed (0 alerts)

The changes ensure that the "dismiss notification" context menu option appears/disappears correctly without requiring a manual refresh of the PR view.

Original prompt

This section details on the original issue you should resolve

<issue_title>Dismiss notification without opening PR Overview</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)

@benibenj GitHub Pull Request Notifications can now be dismissed by right clicking on the PR tree node. 1. Test by creating a notification for a PR (ask someone else (or second account) comments on your PR maybe?) 2. Right click the PR which has the notification. Click the dismiss notification option @TylerLeonhardt This has been working on-and-off for me... not sure why... from what I can tell you is...
  1. have a PR in a repo
  2. checkout main
  3. focus the PR view
  4. leave it focused ...don't unfocus the PR view at all
  5. have someone trigger a notification on that PR

Two bugs from what I can tell.

  1. After they comment, hit the refresh button in the PR view... no notification shows up 🐛

  2. Now focus the issues view

  3. Notification in PR view pops up... right click on it

🐛 No option to dismiss a notification
image

Now click refresh PR view.... the dismiss a notification option is now there.</comment_new>
<comment_new>@benibenj
I was not able to make this fix today. However, it should not be that hard. On the PRNode we could just listen for the notification change event and get the PRIdentifier from the uri to compare with the PR model and figure out if the node has to be refreshed or not.</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 9, 2025 11:34
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Listen for notification changes from both NotificationsManager and PrsTreeModel.
When a notification affecting this PR changes, refresh the node to update its
context value, which controls whether the dismiss notification option appears.

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

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

@copilot continue

Linters, code review, and CodeQL security scan all passed.
The implementation correctly listens for notification changes
and refreshes PR nodes to update the dismiss notification option.

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 18, 2025

@copilot continue

✅ Done! All checks have passed:

  • Linters and hygiene checks: passing
  • Code review: no issues found
  • CodeQL security scan: 0 alerts

The implementation adds notification change listeners to PRNode that automatically refresh the node when notifications affecting that PR change. This ensures the "dismiss notification" context menu option appears/disappears correctly without requiring a manual refresh.

Commit: 0943d60

Copilot AI changed the title [WIP] Fix dismiss notification functionality in PR view Fix dismiss notification functionality in PR view Dec 18, 2025
Copilot AI requested a review from alexr00 December 18, 2025 13:49
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.

Dismiss notification without opening PR Overview

2 participants