Skip to content

Commit dd313f7

Browse files
authored
fix: Fix intermittently-missing SQL autocomplete suggestions (#1980)
1 parent cdc29d5 commit dd313f7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.changeset/tasty-owls-heal.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hyperdx/app": patch
3+
---
4+
5+
fix: Fix intermittently-missing SQL autocomplete suggestions

packages/app/src/components/SQLEditor/SQLInlineEditor.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,10 @@ export default function SQLInlineEditor({
144144

145145
const compartmentRef = useRef<Compartment>(new Compartment());
146146

147+
const hasNonEmptyValue = value.trim().length > 0;
148+
147149
const updateAutocompleteColumns = useCallback(
148150
(viewRef: EditorView) => {
149-
const currentText = viewRef.state.doc.toString();
150151
const identifiers = [
151152
...(filteredFields?.map(column => {
152153
if (column.path.length > 1) {
@@ -171,15 +172,16 @@ export default function SQLInlineEditor({
171172
});
172173
viewRef.dispatch({
173174
effects: compartmentRef.current.reconfigure(
174-
currentText.length > 0 ? auto : queryHistoryList,
175+
hasNonEmptyValue ? auto : queryHistoryList,
175176
),
176177
});
177178
},
178179
[
179180
filteredFields,
180181
additionalSuggestions,
181-
createHistoryList,
182182
disableKeywordAutocomplete,
183+
createHistoryList,
184+
hasNonEmptyValue,
183185
],
184186
);
185187

0 commit comments

Comments
 (0)