Skip to content

Commit 0e6d3a2

Browse files
Merge pull request #1471 from RedisInsight/fe/feature/bugfix
#RI-3893 - Wrong key is displayed sometimes
2 parents 23f8d98 + efbc120 commit 0e6d3a2

File tree

1 file changed

+5
-5
lines changed
  • redisinsight/ui/src/pages/browser/components/key-tree

1 file changed

+5
-5
lines changed

redisinsight/ui/src/pages/browser/components/key-tree/KeyTree.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export interface Props {
3636
export const firstPanelId = 'tree'
3737
export const secondPanelId = 'keys'
3838

39+
const parseKeyNames = (keys: GetKeyInfoResponse[]) =>
40+
keys.map((item) =>
41+
({ ...item, nameString: item.nameString ?? bufferToString(item.name) }))
42+
3943
const KeyTree = forwardRef((props: Props, ref) => {
4044
const { selectKey, loadMoreItems, loading, keysState } = props
4145

@@ -53,7 +57,7 @@ const KeyTree = forwardRef((props: Props, ref) => {
5357
const [keyListState, setKeyListState] = useState<KeysStoreData>(keysState)
5458
const [constructingTree, setConstructingTree] = useState(false)
5559
const [selectDefaultLeaf, setSelectDefaultLeaf] = useState(isEmpty(selectedLeaf))
56-
const [items, setItems] = useState<IKeyPropTypes[]>(keysState.keys ?? [])
60+
const [items, setItems] = useState<IKeyPropTypes[]>(parseKeyNames(keysState.keys ?? []))
5761

5862
const dispatch = useDispatch()
5963

@@ -107,10 +111,6 @@ const KeyTree = forwardRef((props: Props, ref) => {
107111
}, 0)
108112
}
109113

110-
const parseKeyNames = (keys: GetKeyInfoResponse[]) =>
111-
keys.map((item) =>
112-
({ ...item, nameString: item.nameString ?? bufferToString(item.name) }))
113-
114114
const updateKeysList = (items:any = {}) => {
115115
startTransition(() => {
116116
const newState:KeysStoreData = {

0 commit comments

Comments
 (0)