Skip to content
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand Down