@@ -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 ) ;
@@ -723,7 +722,9 @@ export class ServerManagerView {
723722 return ;
724723 }
725724
726- delete this . tabs [ tab . properties . index ] ; // eslint-disable-line @typescript-eslint/no-array-delete
725+ this . tabs = this . tabs . filter (
726+ ( tabObject ) => tabObject . properties . tabId !== tabId ,
727+ ) ;
727728 await tab . destroy ( ) ;
728729 this . functionalTabs . delete ( page ) ;
729730
@@ -1069,9 +1070,9 @@ export class ServerManagerView {
10691070 ipcRenderer . on (
10701071 "update-realm-name" ,
10711072 ( event , serverURL : string , realmName : string ) => {
1072- for ( const [ index , domain ] of DomainUtil . getDomains ( ) . entries ( ) ) {
1073+ for ( const domain of DomainUtil . getDomains ( ) ) {
10731074 if ( domain . url === serverURL ) {
1074- const tab = this . tabs [ index ] ;
1075+ const tab = this . getTabById ( domain . id ) ;
10751076 if ( tab instanceof ServerTab ) tab . setLabel ( realmName ) ;
10761077 domain . alias = realmName ;
10771078 DomainUtil . updateDomainById ( domain . id , domain ) ;
@@ -1089,10 +1090,10 @@ export class ServerManagerView {
10891090 "update-realm-icon" ,
10901091 async ( event , serverURL : string , iconURL : string ) => {
10911092 await Promise . all (
1092- DomainUtil . getDomains ( ) . map ( async ( domain , index ) => {
1093+ DomainUtil . getDomains ( ) . map ( async ( domain ) => {
10931094 if ( domain . url === serverURL ) {
10941095 const localIconPath = await DomainUtil . saveServerIcon ( iconURL ) ;
1095- const tab = this . tabs [ index ] ;
1096+ const tab = this . getTabById ( domain . id ) ;
10961097 if ( tab instanceof ServerTab )
10971098 tab . setIcon ( DomainUtil . iconAsUrl ( localIconPath ) ) ;
10981099 domain . icon = localIconPath ;
0 commit comments