@@ -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+
181184interface QueryStats {
182185 durationUs ?: string | number ;
183186 endTime ?: string | number ;
@@ -188,12 +191,12 @@ const DEFAULT_CONCURRENT_RESULTS = false;
188191
189192export 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