File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -533,6 +533,12 @@ export class MultiFileDiffViewerState {
533533
534534 scrollToFile ( fileIdx : number , options : { autoExpand ?: boolean ; smooth ?: boolean ; focus ?: boolean } = { } ) {
535535 if ( ! this . vlist ) return ;
536+ const vlistFileIdx = this . filteredFileDetails . vlistIndices [ fileIdx ] ;
537+ if ( vlistFileIdx === - 1 ) {
538+ // File is filtered out, cannot scroll to it.
539+ // This should only happen when a file is selected via URL but excluded by default filters.
540+ return ;
541+ }
536542
537543 const autoExpand = options . autoExpand ?? true ;
538544 const smooth = options . smooth ?? false ;
@@ -543,7 +549,6 @@ export class MultiFileDiffViewerState {
543549 // Auto-expand on jump when not checked
544550 fileState . collapsed = false ;
545551 }
546- const vlistFileIdx = this . filteredFileDetails . vlistIndices [ fileIdx ] ;
547552 this . vlist . scrollToIndex ( vlistFileIdx , { align : "start" , smooth } ) ;
548553 if ( focus ) {
549554 requestAnimationFrame ( ( ) => {
You can’t perform that action at this time.
0 commit comments