diff --git a/components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts b/components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts index 284c03c8f7..d1d5652b83 100644 --- a/components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts +++ b/components/webui/client/src/pages/SearchPage/SearchState/useUpdateStateWithMetadata.ts @@ -11,6 +11,11 @@ import {SEARCH_UI_STATE} from "./typings"; import {useResultsMetadata} from "./useResultsMetadata"; +/* +* Presto error name for user cancellation +*/ +const PRESTO_CANCEL_ERROR_NAME = "USER_CANCELED"; + /** * Custom hook to update the UI state to `DONE` when the results metadata signal indicates * that the query is complete, or `FAILED` if the query fails. If there is an error, it will @@ -30,6 +35,13 @@ const useUiUpdateOnDoneSignal = () => { updateSearchUiState(SEARCH_UI_STATE.DONE); break; case PRESTO_SEARCH_SIGNAL.FAILED: + // Presto reports query cancellation as a failure, but we treat as a successful + // completion. + if (resultsMetadata.errorName === PRESTO_CANCEL_ERROR_NAME) { + updateSearchUiState(SEARCH_UI_STATE.DONE); + + break; + } updateSearchUiState(SEARCH_UI_STATE.FAILED); notification.error({ description: resultsMetadata.errorMsg || "An error occurred during search",