@@ -79,11 +79,12 @@ export default class TabManager extends Component {
79
79
filteredTabs = filteredTabs . filter ( tab => tab . active ) ;
80
80
}
81
81
82
- if ( filteredTabs . length === 0 ) {
83
- const [ notePath ] = treeService . getHashValueFromAddress ( ) ;
82
+ // resolve before opened tabs can change this
83
+ const [ notePathInUrl , ntxIdInUrl ] = treeService . getHashValueFromAddress ( ) ;
84
84
85
+ if ( filteredTabs . length === 0 ) {
85
86
filteredTabs . push ( {
86
- notePath : notePath || 'root' ,
87
+ notePath : notePathInUrl || 'root' ,
87
88
active : true ,
88
89
hoistedNoteId : glob . extraHoistedNoteId || 'root'
89
90
} ) ;
@@ -95,17 +96,14 @@ export default class TabManager extends Component {
95
96
96
97
await this . tabsUpdate . allowUpdateWithoutChange ( async ( ) => {
97
98
for ( const tab of filteredTabs ) {
98
-
99
99
await this . openContextWithNote ( tab . notePath , tab . active , tab . ntxId , tab . hoistedNoteId , tab . mainNtxId ) ;
100
100
}
101
101
} ) ;
102
102
103
103
// if there's notePath in the URL, make sure it's open and active
104
104
// (useful, for e.g. opening clipped notes from clipper or opening link in an extra window)
105
- if ( treeService . isNotePathInAddress ( ) ) {
106
- const [ notePath , ntxId ] = treeService . getHashValueFromAddress ( ) ;
107
-
108
- await appContext . tabManager . switchToNoteContext ( ntxId , notePath ) ;
105
+ if ( notePathInUrl ) {
106
+ await appContext . tabManager . switchToNoteContext ( ntxIdInUrl , notePathInUrl ) ;
109
107
}
110
108
}
111
109
catch ( e ) {
0 commit comments