Skip to content

Commit 51a8b67

Browse files
committed
fix: queryId
1 parent 3b67518 commit 51a8b67

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ export default function QueryEditor(props: QueryEditorProps) {
148148
database: tenantName,
149149
querySettings,
150150
enableTracingLevel,
151-
queryId,
152151
});
153152
} else {
154153
runningQueryRef.current = sendQuery({
@@ -262,6 +261,7 @@ export default function QueryEditor(props: QueryEditorProps) {
262261
onCollapseResultHandler={onCollapseResultHandler}
263262
type={type}
264263
theme={theme}
264+
key={result?.queryId}
265265
result={result}
266266
tenantName={tenantName}
267267
path={path}

src/store/reducers/query/query.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ interface SendQueryParams extends QueryRequestParams {
178178
enableTracingLevel?: boolean;
179179
}
180180

181+
// Stream query receives queryId from session chunk.
182+
type StreamQueryParams = Omit<SendQueryParams, 'queryId'>;
183+
181184
interface QueryStats {
182185
durationUs?: string | number;
183186
endTime?: string | number;
@@ -188,12 +191,12 @@ const DEFAULT_CONCURRENT_RESULTS = false;
188191

189192
export const queryApi = api.injectEndpoints({
190193
endpoints: (build) => ({
191-
useStreamQuery: build.mutation<null, SendQueryParams>({
194+
useStreamQuery: build.mutation<null, StreamQueryParams>({
192195
queryFn: async (
193-
{query, database, querySettings = {}, enableTracingLevel, queryId},
196+
{query, database, querySettings = {}, enableTracingLevel},
194197
{signal, dispatch, getState},
195198
) => {
196-
dispatch(setQueryResult({type: 'execute', queryId, isLoading: true}));
199+
dispatch(setQueryResult({type: 'execute', queryId: '', isLoading: true}));
197200

198201
const {action, syntax} = getActionAndSyntaxFromQueryMode(
199202
'execute',
@@ -268,7 +271,7 @@ export const queryApi = api.injectEndpoints({
268271
type: 'execute',
269272
error,
270273
isLoading: false,
271-
queryId,
274+
queryId: state.query.result?.queryId || '',
272275
}),
273276
);
274277
return {error};

0 commit comments

Comments
 (0)