@@ -5,7 +5,6 @@ import {isEqual} from 'lodash';
55import { v4 as uuidv4 } from 'uuid' ;
66
77import SplitPane from '../../../../components/SplitPane' ;
8- import { cancelQueryApi } from '../../../../store/reducers/cancelQuery' ;
98import {
109 useStreamingAvailable ,
1110 useTracingLevelOptionAvailable ,
@@ -92,12 +91,11 @@ export default function QueryEditor(props: QueryEditorProps) {
9291 LAST_USED_QUERY_ACTION_KEY ,
9392 ) ;
9493 const [ lastExecutedQueryText , setLastExecutedQueryText ] = React . useState < string > ( '' ) ;
95- const [ isQueryStreamingEnabled ] = useSetting ( ENABLE_QUERY_STREAMING ) ;
94+ const [ isQueryStreamingEnabled ] = useSetting < boolean > ( ENABLE_QUERY_STREAMING ) ;
9695 const isStreamingEnabled = useStreamingAvailable ( ) && isQueryStreamingEnabled ;
9796
9897 const [ sendQuery ] = queryApi . useUseSendQueryMutation ( ) ;
9998 const [ streamQuery ] = queryApi . useUseStreamQueryMutation ( ) ;
100- const [ sendCancelQuery , cancelQueryResponse ] = cancelQueryApi . useCancelQueryMutation ( ) ;
10199
102100 const runningQueryRef = React . useRef < { abort : VoidFunction } | null > ( null ) ;
103101
@@ -202,14 +200,6 @@ export default function QueryEditor(props: QueryEditorProps) {
202200 dispatchResultVisibilityState ( PaneVisibilityActionTypes . triggerExpand ) ;
203201 } ) ;
204202
205- const handleCancelRunningQuery = React . useCallback ( ( ) => {
206- if ( isStreamingEnabled && runningQueryRef . current ) {
207- runningQueryRef . current . abort ( ) ;
208- } else if ( result ?. queryId ) {
209- sendCancelQuery ( { queryId : result ?. queryId , database : tenantName } ) ;
210- }
211- } , [ isStreamingEnabled , result ?. queryId , sendCancelQuery , tenantName ] ) ;
212-
213203 const onCollapseResultHandler = ( ) => {
214204 dispatchResultVisibilityState ( PaneVisibilityActionTypes . triggerCollapse ) ;
215205 } ;
@@ -231,6 +221,8 @@ export default function QueryEditor(props: QueryEditorProps) {
231221 highlightedAction = { lastUsedQueryAction }
232222 tenantName = { tenantName }
233223 queryId = { result ?. queryId }
224+ isStreamingEnabled = { isStreamingEnabled }
225+ runningQueryRef = { runningQueryRef }
234226 />
235227 ) ;
236228 } ;
@@ -272,12 +264,10 @@ export default function QueryEditor(props: QueryEditorProps) {
272264 theme = { theme }
273265 key = { result ?. queryId }
274266 result = { result }
275- cancelQueryResponse = { cancelQueryResponse }
276267 tenantName = { tenantName }
277268 path = { path }
278269 showPreview = { showPreview }
279270 queryText = { lastExecutedQueryText }
280- onCancelRunningQuery = { handleCancelRunningQuery }
281271 tableSettings = { tableSettings }
282272 />
283273 </ div >
@@ -294,17 +284,14 @@ interface ResultProps {
294284 type ?: EPathType ;
295285 theme : string ;
296286 result ?: QueryResult ;
297- cancelQueryResponse ?: Pick < QueryResult , 'isLoading' | 'error' > ;
298287 tenantName : string ;
299288 path : string ;
300289 showPreview ?: boolean ;
301290 queryText : string ;
302291 tableSettings ?: Partial < Settings > ;
303- onCancelRunningQuery : VoidFunction ;
304292}
305293function Result ( {
306294 resultVisibilityState,
307- cancelQueryResponse,
308295 onExpandResultHandler,
309296 onCollapseResultHandler,
310297 type,
@@ -315,7 +302,6 @@ function Result({
315302 showPreview,
316303 queryText,
317304 tableSettings,
318- onCancelRunningQuery,
319305} : ResultProps ) {
320306 if ( showPreview ) {
321307 return < Preview database = { tenantName } path = { path } type = { type } /> ;
@@ -329,13 +315,10 @@ function Result({
329315 theme = { theme }
330316 tenantName = { tenantName }
331317 isResultsCollapsed = { resultVisibilityState . collapsed }
332- isCancelError = { Boolean ( cancelQueryResponse ?. error ) }
333- isCancelling = { Boolean ( cancelQueryResponse ?. isLoading ) }
334318 tableSettings = { tableSettings }
335319 onExpandResults = { onExpandResultHandler }
336320 onCollapseResults = { onCollapseResultHandler }
337321 queryText = { queryText }
338- onCancelRunningQuery = { onCancelRunningQuery }
339322 />
340323 ) ;
341324 }
0 commit comments