@@ -382,7 +382,6 @@ export class ServerManagerView {
382382 webview : WebView . create ( {
383383 $root : this . $webviewsContainer ,
384384 rootWebContents,
385- index,
386385 tabId,
387386 url : server . url ,
388387 role : "server" ,
@@ -404,8 +403,8 @@ export class ServerManagerView {
404403 this . loading . has ( ( await tab . webview ) . properties . url ) ,
405404 ) ;
406405 } ,
407- onNetworkError : async ( index : number ) => {
408- await this . openNetworkTroubleshooting ( index ) ;
406+ onNetworkError : async ( id : string ) => {
407+ await this . openNetworkTroubleshooting ( id ) ;
409408 } ,
410409 onTitleChange : this . updateBadge . bind ( this ) ,
411410 preload : url . pathToFileURL ( path . join ( bundlePath , "preload.cjs" ) ) . href ,
@@ -625,8 +624,8 @@ export class ServerManagerView {
625624 } ) ;
626625 }
627626
628- async openNetworkTroubleshooting ( index : number ) : Promise < void > {
629- const tab = this . tabs [ index ] ;
627+ async openNetworkTroubleshooting ( id : string ) : Promise < void > {
628+ const tab = this . getTabById ( id ) ;
630629 if ( ! ( tab instanceof ServerTab ) ) return ;
631630 const webview = await tab . webview ;
632631 const reconnectUtil = new ReconnectUtil ( webview ) ;
@@ -730,7 +729,9 @@ export class ServerManagerView {
730729 return ;
731730 }
732731
733- delete this . tabs [ tab . properties . index ] ; // eslint-disable-line @typescript-eslint/no-array-delete
732+ this . tabs = this . tabs . filter (
733+ ( tabObject ) => tabObject . properties . tabId !== tabId ,
734+ ) ;
734735 await tab . destroy ( ) ;
735736 this . functionalTabs . delete ( page ) ;
736737
@@ -1079,9 +1080,9 @@ export class ServerManagerView {
10791080 ipcRenderer . on (
10801081 "update-realm-name" ,
10811082 ( event , serverURL : string , realmName : string ) => {
1082- for ( const [ index , domain ] of DomainUtil . getDomains ( ) . entries ( ) ) {
1083+ for ( const domain of DomainUtil . getDomains ( ) ) {
10831084 if ( domain . url === serverURL ) {
1084- const tab = this . tabs [ index ] ;
1085+ const tab = this . getTabById ( domain . id ) ;
10851086 if ( tab instanceof ServerTab ) tab . setLabel ( realmName ) ;
10861087 domain . alias = realmName ;
10871088 DomainUtil . updateDomainById ( domain . id , domain ) ;
@@ -1099,10 +1100,10 @@ export class ServerManagerView {
10991100 "update-realm-icon" ,
11001101 async ( event , serverURL : string , iconURL : string ) => {
11011102 await Promise . all (
1102- DomainUtil . getDomains ( ) . map ( async ( domain , index ) => {
1103+ DomainUtil . getDomains ( ) . map ( async ( domain ) => {
11031104 if ( domain . url === serverURL ) {
11041105 const localIconPath = await DomainUtil . saveServerIcon ( iconURL ) ;
1105- const tab = this . tabs [ index ] ;
1106+ const tab = this . getTabById ( domain . id ) ;
11061107 if ( tab instanceof ServerTab )
11071108 tab . setIcon ( DomainUtil . iconAsUrl ( localIconPath ) ) ;
11081109 domain . icon = localIconPath ;
0 commit comments