[maps] abort sync data if any data request fails (#87381)

* [maps] abort sync data if any data request fails

* review feedback

* fix broken rename of e to error

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Nathan Reese 2021-01-11 12:28:24 -07:00 committed by GitHub
parent 2658855cb7
commit 89e7cd6808
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -384,14 +384,11 @@ export class VectorLayer extends AbstractLayer {
join,
propertiesMap,
};
} catch (e) {
if (!(e instanceof DataRequestAbortError)) {
onLoadError(sourceDataId, requestToken, `Join error: ${e.message}`);
} catch (error) {
if (!(error instanceof DataRequestAbortError)) {
onLoadError(sourceDataId, requestToken, `Join error: ${error.message}`);
}
return {
dataHasChanged: true,
join,
};
throw error;
}
}
@ -430,7 +427,7 @@ export class VectorLayer extends AbstractLayer {
};
}
async _performInnerJoins(
_performInnerJoins(
sourceResult: SourceResult,
joinStates: JoinState[],
updateSourceData: DataRequestContext['updateSourceData']
@ -538,9 +535,7 @@ export class VectorLayer extends AbstractLayer {
if (!(error instanceof DataRequestAbortError)) {
onLoadError(dataRequestId, requestToken, error.message);
}
return {
refreshed: false,
};
throw error;
}
}
@ -646,6 +641,7 @@ export class VectorLayer extends AbstractLayer {
if (!(error instanceof DataRequestAbortError)) {
onLoadError(dataRequestId, requestToken, error.message);
}
throw error;
}
}
@ -736,6 +732,7 @@ export class VectorLayer extends AbstractLayer {
stopLoading(dataRequestId, requestToken, formatters, nextMeta);
} catch (error) {
onLoadError(dataRequestId, requestToken, error.message);
throw error;
}
}
@ -757,19 +754,26 @@ export class VectorLayer extends AbstractLayer {
if (this.isLoadingBounds()) {
return;
}
await this._syncSourceStyleMeta(syncContext, source, style);
await this._syncSourceFormatters(syncContext, source, style);
const sourceResult = await this._syncSource(syncContext, source, style);
if (
!sourceResult.featureCollection ||
!sourceResult.featureCollection.features.length ||
!this.hasJoins()
) {
return;
}
const joinStates = await this._syncJoins(syncContext, style);
await this._performInnerJoins(sourceResult, joinStates, syncContext.updateSourceData);
try {
await this._syncSourceStyleMeta(syncContext, source, style);
await this._syncSourceFormatters(syncContext, source, style);
const sourceResult = await this._syncSource(syncContext, source, style);
if (
!sourceResult.featureCollection ||
!sourceResult.featureCollection.features.length ||
!this.hasJoins()
) {
return;
}
const joinStates = await this._syncJoins(syncContext, style);
this._performInnerJoins(sourceResult, joinStates, syncContext.updateSourceData);
} catch (error) {
if (!(error instanceof DataRequestAbortError)) {
throw error;
}
}
}
_getSourceFeatureCollection() {