@@ -387,7 +387,6 @@ export class ServerManagerView {
387387 webview : WebView . create ( {
388388 $root : this . $webviewsContainer ,
389389 rootWebContents,
390- index,
391390 tabId,
392391 url : server . url ,
393392 role : "server" ,
@@ -409,8 +408,8 @@ export class ServerManagerView {
409408 this . loading . has ( ( await tab . webview ) . properties . url ) ,
410409 ) ;
411410 } ,
412- onNetworkError : async ( index : number ) => {
413- await this . openNetworkTroubleshooting ( index ) ;
411+ onNetworkError : async ( id : string ) => {
412+ await this . openNetworkTroubleshooting ( id ) ;
414413 } ,
415414 onTitleChange : this . updateBadge . bind ( this ) ,
416415 preload : url . pathToFileURL ( path . join ( bundlePath , "preload.cjs" ) ) . href ,
@@ -630,8 +629,8 @@ export class ServerManagerView {
630629 } ) ;
631630 }
632631
633- async openNetworkTroubleshooting ( index : number ) : Promise < void > {
634- const tab = this . tabs [ index ] ;
632+ async openNetworkTroubleshooting ( id : string ) : Promise < void > {
633+ const tab = this . getTabById ( id ) ;
635634 if ( ! ( tab instanceof ServerTab ) ) return ;
636635 const webview = await tab . webview ;
637636 const reconnectUtil = new ReconnectUtil ( webview ) ;
@@ -728,7 +727,9 @@ export class ServerManagerView {
728727 return ;
729728 }
730729
731- delete this . tabs [ tab . properties . index ] ; // eslint-disable-line @typescript-eslint/no-array-delete
730+ this . tabs = this . tabs . filter (
731+ ( tabObject ) => tabObject . properties . tabId !== tabId ,
732+ ) ;
732733 await tab . destroy ( ) ;
733734 this . functionalTabs . delete ( page ) ;
734735
@@ -1074,9 +1075,9 @@ export class ServerManagerView {
10741075 ipcRenderer . on (
10751076 "update-realm-name" ,
10761077 ( event , serverURL : string , realmName : string ) => {
1077- for ( const [ index , domain ] of DomainUtil . getDomains ( ) . entries ( ) ) {
1078+ for ( const domain of DomainUtil . getDomains ( ) ) {
10781079 if ( domain . url === serverURL ) {
1079- const tab = this . tabs [ index ] ;
1080+ const tab = this . getTabById ( domain . id ) ;
10801081 if ( tab instanceof ServerTab ) tab . setLabel ( realmName ) ;
10811082 domain . alias = realmName ;
10821083 DomainUtil . updateDomainById ( domain . id , domain ) ;
@@ -1094,10 +1095,10 @@ export class ServerManagerView {
10941095 "update-realm-icon" ,
10951096 async ( event , serverURL : string , iconURL : string ) => {
10961097 await Promise . all (
1097- DomainUtil . getDomains ( ) . map ( async ( domain , index ) => {
1098+ DomainUtil . getDomains ( ) . map ( async ( domain ) => {
10981099 if ( domain . url === serverURL ) {
10991100 const localIconPath = await DomainUtil . saveServerIcon ( iconURL ) ;
1100- const tab = this . tabs [ index ] ;
1101+ const tab = this . getTabById ( domain . id ) ;
11011102 if ( tab instanceof ServerTab )
11021103 tab . setIcon ( DomainUtil . iconAsUrl ( localIconPath ) ) ;
11031104 domain . icon = localIconPath ;
0 commit comments