From 1d1be55d3d4ea621364c37e75de616046371feeb Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Mon, 31 Mar 2025 14:24:34 +0200 Subject: [PATCH] fix: custom connection icon disappears during connection, fixes #939 --- .../components/WorkspaceEditConnectionPanel.vue | 6 +++--- src/renderer/stores/connections.ts | 3 ++- src/renderer/stores/workspaces.ts | 12 +++++------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/renderer/components/WorkspaceEditConnectionPanel.vue b/src/renderer/components/WorkspaceEditConnectionPanel.vue index 2f3fa061..bf5377e1 100644 --- a/src/renderer/components/WorkspaceEditConnectionPanel.vue +++ b/src/renderer/components/WorkspaceEditConnectionPanel.vue @@ -527,14 +527,14 @@ watch(() => props.connection, () => { localConnection.value = JSON.parse(JSON.stringify(props.connection)); }); -const startConnection = async () => { +const startConnection = async (): Promise => { await saveConnection(); isConnecting.value = true; if (localConnection.value.ask) isAsking.value = true; else { - await connectWorkspace(localConnection.value, { signal: abortController.value.signal }).catch(() => undefined); + await connectWorkspace(localConnection.value, { signal: abortController.value.signal }).catch((): void => undefined); isConnecting.value = false; } }; @@ -582,7 +582,7 @@ const continueTest = async (credentials: {user: string; password: string }) => { try { if (isConnecting.value) { const params = Object.assign({}, props.connection, credentials); - await connectWorkspace(params, { signal: abortController.value.signal }).catch(() => undefined); + await connectWorkspace(params, { signal: abortController.value.signal }).catch((): void => undefined); isConnecting.value = false; } else { diff --git a/src/renderer/stores/connections.ts b/src/renderer/stores/connections.ts index 7ad4e644..9828f509 100644 --- a/src/renderer/stores/connections.ts +++ b/src/renderer/stores/connections.ts @@ -163,7 +163,8 @@ export const useConnectionsStore = defineStore('connections', { uid: connection.uid, client: connection.client, icon: conn.icon, - name: conn.name + name: conn.name, + hasCustomIcon: conn.hasCustomIcon }; } return conn; diff --git a/src/renderer/stores/workspaces.ts b/src/renderer/stores/workspaces.ts index 5314b65c..8fe61967 100644 --- a/src/renderer/stores/workspaces.ts +++ b/src/renderer/stores/workspaces.ts @@ -151,7 +151,7 @@ export const useWorkspacesStore = defineStore('workspaces', { this.workspaces = (this.workspaces as Workspace[]).map(workspace => workspace.uid === connection.uid ? { ...workspace, - structure: [], + structure: [] as WorkspaceStructure[], breadcrumbs: {}, loadedSchemas: new Set(), database: connection.database, @@ -167,7 +167,7 @@ export const useWorkspacesStore = defineStore('workspaces', { this.workspaces = (this.workspaces as Workspace[]).map(workspace => workspace.uid === connection.uid ? { ...workspace, - structure: [], + structure: [] as WorkspaceStructure[], breadcrumbs: {}, loadedSchemas: new Set(), connectionStatus: 'disconnected' @@ -187,7 +187,7 @@ export const useWorkspacesStore = defineStore('workspaces', { this.workspaces = (this.workspaces as Workspace[]).map(workspace => workspace.uid === connection.uid ? { ...workspace, - structure: [], + structure: [] as WorkspaceStructure[], breadcrumbs: {}, loadedSchemas: new Set(), connectionStatus: 'failed' @@ -200,9 +200,7 @@ export const useWorkspacesStore = defineStore('workspaces', { return reject(new Error('Connection aborted by user')); else { let clientCustomizations: Customizations; - const { updateLastConnection } = connectionsStore; - - updateLastConnection(connection.uid); + connectionsStore.updateLastConnection(connection.uid); switch (connection.client) { case 'mysql': @@ -418,7 +416,7 @@ export const useWorkspacesStore = defineStore('workspaces', { this.workspaces = (this.workspaces as Workspace[]).map(workspace => workspace.uid === uid ? { ...workspace, - structure: [], + structure: [] as WorkspaceStructure[], breadcrumbs: {}, loadedSchemas: new Set(), connectionStatus: 'disconnected'