Skip to content

Commit db273d9

Browse files
authored
Merge pull request #352 from RedisInsight/bugfix/RI-2476-RI-2478
#RI-2478 - clear history position for wb after end of the list
2 parents 2502b6e + cd3aa9a commit db273d9

File tree

1 file changed

+7
-1
lines changed
  • redisinsight/ui/src/components/query/Query

1 file changed

+7
-1
lines changed

redisinsight/ui/src/components/query/Query/Query.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ const Query = (props: Props) => {
9595

9696
const onChange = (value: string = '') => {
9797
setQuery(value)
98+
99+
// clear history position after scrolling all list with empty value
100+
if (value === '' && execHistoryPos >= execHistory.length) {
101+
execHistoryPos = 0
102+
}
98103
}
99104

100105
const handleKeyDown = (e: React.KeyboardEvent) => {
@@ -127,7 +132,8 @@ const Query = (props: Props) => {
127132
const { editor } = monacoObjects?.current
128133

129134
const position = editor.getPosition()
130-
if (position?.lineNumber !== 1) return
135+
// @ts-ignore
136+
if (position?.lineNumber !== 1 || editor.getContribution('editor.contrib.suggestController')?.model?.state) return
131137

132138
if (execHistory[execHistoryPos]) {
133139
const command = execHistory[execHistoryPos].command || ''

0 commit comments

Comments
 (0)