@@ -63,6 +63,7 @@ export class KdbNewConnectionView extends LitElement {
6363 isBundledQ : boolean = true ;
6464 oldAlias : string = "" ;
6565 editAuth : boolean = false ;
66+ renderId : string = "" ;
6667 private isModalOpen = false ;
6768 private _connectionData : EditConnectionMessage | undefined = undefined ;
6869 private readonly vscode = acquireVsCodeApi ( ) ;
@@ -144,7 +145,6 @@ export class KdbNewConnectionView extends LitElement {
144145
145146 handleMessage ( event : { data : any } ) {
146147 const message = event . data ;
147- console . log ( message ) ;
148148 if ( message . command === "editConnection" ) {
149149 this . connectionData = message . data ;
150150 this . labels = message . labels ;
@@ -397,15 +397,12 @@ export class KdbNewConnectionView extends LitElement {
397397 }
398398
399399 renderLblDropdownOptions ( pos : number ) {
400- console . log ( this . labels ) ;
401400 return html `
402401 < sl-option > No Label Selected </ sl-option >
403402 ${ repeat (
404403 this . lblNamesList ,
405404 ( lbl ) => lbl ,
406405 ( lbl ) => {
407- console . log ( lbl . name ) ;
408- console . log ( lbl . name === this . labels [ pos ] ) ;
409406 return html `
410407 < sl-option .value ="${ encodeURIComponent ( lbl . name ) } ">
411408 < span >
@@ -749,7 +746,13 @@ export class KdbNewConnectionView extends LitElement {
749746 return html `< div > No connection found to be edited</ div > ` ;
750747 }
751748 this . isBundledQ = this . connectionData . connType === ConnectionType . BundledQ ;
752- this . oldAlias = this . connectionData . serverName ;
749+ if (
750+ this . renderId === "" ||
751+ this . oldAlias !== this . connectionData . serverName
752+ ) {
753+ this . oldAlias = this . connectionData . serverName ;
754+ this . renderId = "" ;
755+ }
753756 const connTypeName = this . defineConnTypeName ( this . connectionData . connType ) ;
754757 this . serverType =
755758 this . connectionData . connType === ConnectionType . Insights
@@ -813,9 +816,14 @@ export class KdbNewConnectionView extends LitElement {
813816 if ( ! this . connectionData ) {
814817 return html `< div > No connection found to be edited</ div > ` ;
815818 }
816- this . bundledServer . serverAlias = "local" ;
817- this . bundledServer . serverPort = this . connectionData . port ?? "" ;
818- this . bundledServer . serverName = this . connectionData . serverAddress ;
819+
820+ if ( this . renderId === "" ) {
821+ this . renderId = this . generateRenderId ( ) ;
822+ this . bundledServer . serverAlias = "local" ;
823+ this . bundledServer . serverPort = this . connectionData . port ?? "" ;
824+ this . bundledServer . serverName = this . connectionData . serverAddress ;
825+ }
826+
819827 return html `
820828 < div class ="col ">
821829 < div class ="row ">
@@ -839,11 +847,16 @@ export class KdbNewConnectionView extends LitElement {
839847 if ( ! this . connectionData ) {
840848 return html `< div > No connection found to be edited</ div > ` ;
841849 }
842- this . kdbServer . serverAlias = this . connectionData . serverName ;
843- this . kdbServer . serverPort = this . connectionData . port ?? "" ;
844- this . kdbServer . serverName = this . connectionData . serverAddress ;
845- this . kdbServer . auth = this . connectionData . auth ?? false ;
846- this . kdbServer . tls = this . connectionData . tls ?? false ;
850+
851+ if ( this . renderId === "" ) {
852+ this . renderId = this . generateRenderId ( ) ;
853+ this . kdbServer . serverAlias = this . connectionData . serverName ;
854+ this . kdbServer . serverPort = this . connectionData . port ?? "" ;
855+ this . kdbServer . serverName = this . connectionData . serverAddress ;
856+ this . kdbServer . auth = this . connectionData . auth ?? false ;
857+ this . kdbServer . tls = this . connectionData . tls ?? false ;
858+ }
859+
847860 return html `
848861 < div class ="col ">
849862 < div class ="row ">
@@ -926,9 +939,14 @@ export class KdbNewConnectionView extends LitElement {
926939 if ( ! this . connectionData ) {
927940 return html `< div > No connection found to be edited</ div > ` ;
928941 }
929- this . insightsServer . alias = this . connectionData . serverName ;
930- this . insightsServer . server = this . connectionData . serverAddress ;
931- this . insightsServer . realm = this . connectionData . realm ?? "" ;
942+
943+ if ( this . renderId === "" ) {
944+ this . renderId = this . generateRenderId ( ) ;
945+ this . insightsServer . alias = this . connectionData . serverName ;
946+ this . insightsServer . server = this . connectionData . serverAddress ;
947+ this . insightsServer . realm = this . connectionData . realm ?? "" ;
948+ }
949+
932950 return html `
933951 < div class ="col ">
934952 < div class ="row ">
@@ -1042,6 +1060,13 @@ export class KdbNewConnectionView extends LitElement {
10421060 } ) ;
10431061 }
10441062 }
1063+
1064+ private generateRenderId ( ) : string {
1065+ let counter = 0 ;
1066+ const timestamp = Date . now ( ) . toString ( 36 ) ;
1067+ const uniqueCounter = ( counter ++ ) . toString ( 36 ) ;
1068+ return `render-${ timestamp } -${ uniqueCounter } ` ;
1069+ }
10451070}
10461071
10471072declare global {
0 commit comments