@@ -18,6 +18,7 @@ import DiffFileTreeItem from './DiffFileTreeItem.vue';
1818import  {doLoadMoreFiles } from  ' ../features/repo-diff.js' 
1919import  {toggleElem } from  ' ../utils/dom.js' 
2020import  {DiffTreeStore } from  ' ../modules/stores.js' 
21+ import  {setFileFolding } from  ' ../features/file-fold.js' 
2122
2223const  {pageData } =  window .config ;
2324const  LOCAL_STORAGE_KEY  =  ' diff_file_tree_visible' 
@@ -104,6 +105,7 @@ export default {
104105
105106    this .hashChangeListener  =  () =>  { 
106107      this .store .selectedItem  =  window .location .hash ; 
108+       this .expandSelectedFile (); 
107109    }; 
108110    this .hashChangeListener (); 
109111    window .addEventListener (' hashchange' this .hashChangeListener ); 
@@ -113,6 +115,14 @@ export default {
113115    window .removeEventListener (' hashchange' this .hashChangeListener ); 
114116  }, 
115117  methods:  { 
118+     expandSelectedFile () { 
119+       //  expand file if the selected file is folded 
120+       if  (this .store .selectedItem ) { 
121+         const  box  =  document .querySelector (this .store .selectedItem ); 
122+         const  folded  =  box? .getAttribute (' data-folded' ===  ' true'  
123+         if  (folded) setFileFolding (box, box .querySelector (' .fold-file' false ); 
124+       } 
125+     }, 
116126    toggleVisibility () { 
117127      this .updateVisibility (! this .fileTreeIsVisible ); 
118128    }, 
0 commit comments