Skip to content

Commit b1399ce

Browse files
fix: copilot comments
1 parent 9d4d454 commit b1399ce

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

src/containers/Tenant/Query/QueryEditor/QueryEditor.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,15 @@ export default function QueryEditor(props: QueryEditorProps) {
181181
base64: encodeTextWithBase64,
182182
});
183183

184-
query.then(({data}) => {
185-
if (data?.queryId) {
186-
updateQueryInHistory(data.queryId, data?.queryStats);
187-
}
188-
});
184+
query
185+
.then(({data}) => {
186+
if (data?.queryId) {
187+
updateQueryInHistory(data.queryId, data?.queryStats);
188+
}
189+
})
190+
.catch((error) => {
191+
console.error('Failed to update query history:', error);
192+
});
189193

190194
queryManagerInstance.registerQuery(query);
191195
}

src/store/reducers/query/query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export const queryApi = api.injectEndpoints({
236236
}
237237
},
238238
}),
239-
useSendQuery: build.mutation({
239+
useSendQuery: build.mutation<{queryStats: QueryStats; queryId: string}, SendQueryParams>({
240240
queryFn: async (
241241
{
242242
actionType = 'execute',
@@ -246,7 +246,7 @@ export const queryApi = api.injectEndpoints({
246246
enableTracingLevel,
247247
queryId,
248248
base64,
249-
}: SendQueryParams,
249+
},
250250
{signal, dispatch, getState},
251251
) => {
252252
const startTime = Date.now();

src/store/reducers/query/useQueriesHistory.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function useQueriesHistory() {
5050
: historyQueries;
5151
}, [historyQueries, queriesFilter]);
5252

53-
// These function are used inside Monaco editorDidMount
53+
// These functions are used inside Monaco editorDidMount
5454
// They should be stable to work properly
5555
const goToPreviousQuery = useEventHandler(() => {
5656
setCurrentIndex((index) => {
@@ -87,6 +87,7 @@ export function useQueriesHistory() {
8787
historyQueries.length >= MAXIMUM_QUERIES_IN_HISTORY ? 1 : 0,
8888
);
8989
saveHistoryQueries(newQueries);
90+
setQueries(newQueries);
9091
// Update currentIndex to point to the newly added query
9192
const newCurrentIndex = newQueries.length - 1;
9293
setCurrentIndex(newCurrentIndex);
@@ -108,6 +109,7 @@ export function useQueriesHistory() {
108109
endTime,
109110
});
110111
saveHistoryQueries(newQueries);
112+
setQueries(newQueries);
111113
}
112114
});
113115

0 commit comments

Comments
 (0)