@@ -5,11 +5,11 @@ import { useShallow } from 'zustand/react/shallow'
5
5
import { KeyTypes , SelectedKeyActionType , StorageItem , VscodeMessageAction } from 'uiSrc/constants'
6
6
import { sendEventTelemetry , TelemetryEvent } from 'uiSrc/utils'
7
7
import { RedisString } from 'uiSrc/interfaces'
8
- import { useSelectedKeyStore } from 'uiSrc/store'
8
+ import { useDatabasesStore , useSelectedKeyStore } from 'uiSrc/store'
9
9
import { sessionStorageService , vscodeApi } from 'uiSrc/services'
10
10
import { DynamicTypeDetails } from './components/dynamic-type-details'
11
11
12
- import { useKeysApi , useKeysInContext } from '../keys-tree/hooks/useKeys'
12
+ import { useKeysApi } from '../keys-tree/hooks/useKeys'
13
13
import styles from './styles.module.scss'
14
14
15
15
export interface Props { }
@@ -21,7 +21,8 @@ const KeyDetails = () => {
21
21
loading : state . loading ,
22
22
} ) ) )
23
23
24
- const databaseId = useKeysInContext ( ( state ) => state . databaseId )
24
+ const database = useDatabasesStore ( ( state ) => state . connectedDatabase )
25
+ const databaseId = database ?. id
25
26
26
27
const keysApi = useKeysApi ( )
27
28
@@ -54,14 +55,14 @@ const KeyDetails = () => {
54
55
const onRemoveKey = ( ) => {
55
56
vscodeApi . postMessage ( {
56
57
action : VscodeMessageAction . CloseKeyAndRefresh ,
57
- data : { key : keyName , type : SelectedKeyActionType . Removed , databaseId : databaseId ! } ,
58
+ data : { key : keyName , type : SelectedKeyActionType . Removed , database : database ! } ,
58
59
} )
59
60
}
60
61
61
62
const onEditKey = ( key : RedisString , newKey : RedisString ) => {
62
63
vscodeApi . postMessage ( {
63
64
action : VscodeMessageAction . EditKeyName ,
64
- data : { key, newKey, type : SelectedKeyActionType . Renamed , databaseId : databaseId ! } ,
65
+ data : { key, newKey, type : SelectedKeyActionType . Renamed , database : database ! } ,
65
66
} )
66
67
}
67
68
0 commit comments