File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -155,22 +155,18 @@ class ServerManagerView {
155
155
initTabs ( ) {
156
156
const servers = DomainUtil . getDomains ( ) ;
157
157
if ( servers . length > 0 ) {
158
+ for ( let i = 0 ; i < servers . length ; i ++ ) {
159
+ this . initServer ( servers [ i ] , i ) ;
160
+ DomainUtil . updateSavedServer ( servers [ i ] . url , i ) ;
161
+ }
162
+ // activate last active tab and load its webview first
158
163
const lastActiveTab = ConfigUtil . getConfigItem ( 'lastActiveTab' ) ;
159
- this . initServer ( servers [ lastActiveTab ] , 0 ) ;
160
- DomainUtil . updateSavedServer ( servers [ lastActiveTab ] . url , 0 ) ;
161
- this . activateTab ( 0 ) ;
164
+ this . activateTab ( lastActiveTab ) ;
162
165
for ( let i = 0 ; i < servers . length ; i ++ ) {
163
- let index = i ;
164
- if ( i < lastActiveTab ) {
165
- ++ index ;
166
- } else if ( i > lastActiveTab ) {
167
- -- index ;
168
- } else {
166
+ if ( i === lastActiveTab ) {
169
167
continue ;
170
168
}
171
- this . initServer ( servers [ i ] , index ) ;
172
- DomainUtil . updateSavedServer ( servers [ i ] . url , index ) ;
173
- this . tabs [ index ] . loadWebview ( ) ;
169
+ this . tabs [ i ] . loadWebview ( ) ;
174
170
}
175
171
// Remove focus from the settings icon at sidebar bottom
176
172
this . $settingsButton . classList . remove ( 'active' ) ;
You can’t perform that action at this time.
0 commit comments