[Maps] fix multi-select query from Controls visualization not always getting applied to map in dashboard (#87310)
* [Maps] fix multi-select query from Controls visualization not always getting applied to map in dashboard * fix underlying problem in blended layer * clean-up Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
9d4ef37f4e
commit
8cb622617c
|
@ -227,11 +227,15 @@ function endDataLoad(
|
|||
data: object,
|
||||
meta: DataMeta
|
||||
) {
|
||||
return async (
|
||||
return (
|
||||
dispatch: ThunkDispatch<MapStoreState, void, AnyAction>,
|
||||
getState: () => MapStoreState
|
||||
) => {
|
||||
dispatch(unregisterCancelCallback(requestToken));
|
||||
const dataRequest = getDataRequestDescriptor(getState(), layerId, dataId);
|
||||
if (dataRequest && dataRequest.dataRequestToken !== requestToken) {
|
||||
throw new DataRequestAbortError();
|
||||
}
|
||||
|
||||
const features = data && 'features' in data ? (data as FeatureCollection).features : [];
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ import {
|
|||
import { IVectorSource } from '../../sources/vector_source';
|
||||
import { LICENSED_FEATURES } from '../../../licensed_features';
|
||||
import { ESSearchSource } from '../../sources/es_search_source/es_search_source';
|
||||
import { isSearchSourceAbortError } from '../../sources/es_source/es_source';
|
||||
|
||||
const ACTIVE_COUNT_DATA_ID = 'ACTIVE_COUNT_DATA_ID';
|
||||
|
||||
|
@ -311,14 +312,16 @@ export class BlendedVectorLayer extends VectorLayer implements IVectorLayer {
|
|||
let isSyncClustered;
|
||||
try {
|
||||
syncContext.startLoading(dataRequestId, requestToken, searchFilters);
|
||||
const abortController = new AbortController();
|
||||
syncContext.registerCancelCallback(requestToken, () => abortController.abort());
|
||||
const searchSource = await this._documentSource.makeSearchSource(searchFilters, 0);
|
||||
const resp = await searchSource.fetch();
|
||||
const resp = await searchSource.fetch({ abortSignal: abortController.signal });
|
||||
const maxResultWindow = await this._documentSource.getMaxResultWindow();
|
||||
isSyncClustered = resp.hits.total > maxResultWindow;
|
||||
const countData = { isSyncClustered } as CountData;
|
||||
syncContext.stopLoading(dataRequestId, requestToken, countData, searchFilters);
|
||||
} catch (error) {
|
||||
if (!(error instanceof DataRequestAbortError)) {
|
||||
if (!(error instanceof DataRequestAbortError) || !isSearchSourceAbortError(error)) {
|
||||
syncContext.onLoadError(dataRequestId, requestToken, error.message);
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -40,6 +40,10 @@ import {
|
|||
} from '../../../../../../../src/plugins/inspector/common/adapters';
|
||||
import { isValidStringConfig } from '../../util/valid_string_config';
|
||||
|
||||
export function isSearchSourceAbortError(error: Error) {
|
||||
return error.name === 'AbortError';
|
||||
}
|
||||
|
||||
export interface IESSource extends IVectorSource {
|
||||
isESSource(): true;
|
||||
getId(): string;
|
||||
|
@ -191,7 +195,7 @@ export class AbstractESSource extends AbstractVectorSource implements IESSource
|
|||
if (inspectorRequest) {
|
||||
inspectorRequest.error(error);
|
||||
}
|
||||
if (error.name === 'AbortError') {
|
||||
if (isSearchSourceAbortError(error)) {
|
||||
throw new DataRequestAbortError();
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,9 @@ export class MapEmbeddable
|
|||
|
||||
this._savedMap = new SavedMap({ mapEmbeddableInput: initialInput });
|
||||
this._initializeSaveMap();
|
||||
this._subscription = this.getInput$().subscribe((input) => this.onContainerStateChanged(input));
|
||||
this._subscription = this.getUpdated$().subscribe(() =>
|
||||
this.onContainerStateChanged(this.input)
|
||||
);
|
||||
}
|
||||
|
||||
private async _initializeSaveMap() {
|
||||
|
|
Loading…
Reference in a new issue