@@ -109,24 +109,46 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode
109109 }
110110
111111 public static override refresh ( ) : void {
112- if ( this . currentPanel ) {
113- this . currentPanel . refreshPanel ( ) ;
112+ const panel = this . getActivePanel ( ) ;
113+ if ( panel ) {
114+ panel . refreshPanel ( ) ;
114115 }
115116 }
116117
117- public static scrollToReview ( ) : void {
118- if ( this . currentPanel ) {
119- this . currentPanel . _postMessage ( { command : 'pr.scrollToPendingReview' } ) ;
118+ public static scrollToReview ( owner : string , repo : string , number : number ) : void {
119+ const panel = this . findPanel ( owner , repo , number ) ;
120+ if ( panel ) {
121+ panel . scrollToPendingReview ( ) ;
120122 }
121123 }
122124
125+ /**
126+ * Scroll the webview to the pending review section.
127+ */
128+ public scrollToPendingReview ( ) : void {
129+ this . _postMessage ( { command : 'pr.scrollToPendingReview' } ) ;
130+ }
131+
123132 /**
124133 * Get the currently active pull request from the current panel
125134 */
126135 public static getCurrentPullRequest ( ) : PullRequestModel | undefined {
127136 return this . currentPanel ?. _item ;
128137 }
129138
139+ /**
140+ * Return the panel whose webview is currently active (focused),
141+ * or `undefined` when no PR panel is active.
142+ * Today there is at most one panel; with multiple panels this
143+ * will iterate the panel map.
144+ */
145+ public static override getActivePanel ( ) : PullRequestOverviewPanel | undefined {
146+ if ( this . currentPanel ?. _panel . active ) {
147+ return this . currentPanel ;
148+ }
149+ return undefined ;
150+ }
151+
130152 /**
131153 * Find the panel showing a specific pull request.
132154 * Currently there is at most one panel, but this will support
0 commit comments