Skip to content

Commit 15bf422

Browse files
committed
fix pr comments
1 parent 78bf145 commit 15bf422

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export async function activate(context: vscode.ExtensionContext) {
8484
viewId: ViewId.AddKey,
8585
handleMessage: (message) => handleMessage(message),
8686
message: args,
87-
})
87+
}).postMessage({ action: 'SetDatabase', data: { database: args.data?.database } })
8888
}),
8989

9090
vscode.commands.registerCommand('RedisForVSCode.addDatabase', (args) => {

src/webviews/src/modules/config/Config.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useShallow } from 'zustand/react/shallow'
33

44
import { useLocation } from 'react-router-dom'
55
import { isDifferentConsentsExists } from 'uiSrc/utils'
6-
import { fetchDatabases } from 'uiSrc/store'
6+
import { fetchDatabases, useDatabasesStore } from 'uiSrc/store'
77
import { fetchAppInfo, useAppInfoStore } from 'uiSrc/store/hooks/use-app-info-store/useAppInfoStore'
88
import { vscodeApi } from 'uiSrc/services'
99
import { VscodeMessageAction } from 'uiSrc/constants'
@@ -23,6 +23,10 @@ export const Config = () => {
2323
appInfo.setInitialStateAppInfo()
2424
fetchDatabases()
2525

26+
if (window.ri?.database) {
27+
useDatabasesStore.getState().setConnectedDatabase(window.ri.database)
28+
}
29+
2630
if (window.ri?.appInfo) {
2731
appInfo.setAppInfo(window.ri?.appInfo)
2832
return

0 commit comments

Comments
 (0)