[maps] replace 'refresh: true' with 'refresh: wait_for' (#158220)

Fixes https://github.com/elastic/kibana/issues/157657

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Nathan Reese 2023-05-30 10:01:31 -06:00 committed by GitHub
parent c9658bf238
commit 47eed48cde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View file

@ -36,6 +36,7 @@ export function FeatureEditTools(props: Props) {
const drawBBoxSelected = props.drawShape === DRAW_SHAPE.BOUNDS;
const drawPointSelected = props.drawShape === DRAW_SHAPE.POINT;
const deleteSelected = props.drawShape === DRAW_SHAPE.DELETE;
const isWaiting = props.drawShape === DRAW_SHAPE.WAIT;
function toggleDrawShape(mode: DRAW_SHAPE) {
if (mode && props.drawShape === mode) {
@ -70,6 +71,7 @@ export function FeatureEditTools(props: Props) {
aria-pressed={drawLineSelected}
isSelected={drawLineSelected}
display={drawLineSelected ? 'fill' : 'empty'}
isDisabled={isWaiting}
/>
<EuiButtonIcon
@ -89,6 +91,7 @@ export function FeatureEditTools(props: Props) {
aria-pressed={drawPolygonSelected}
isSelected={drawPolygonSelected}
display={drawPolygonSelected ? 'fill' : 'empty'}
isDisabled={isWaiting}
/>
<EuiButtonIcon
className={classNames({
@ -107,6 +110,7 @@ export function FeatureEditTools(props: Props) {
aria-pressed={drawCircleSelected}
isSelected={drawCircleSelected}
display={drawCircleSelected ? 'fill' : 'empty'}
isDisabled={isWaiting}
/>
<EuiButtonIcon
className={classNames({
@ -125,6 +129,7 @@ export function FeatureEditTools(props: Props) {
aria-pressed={drawBBoxSelected}
isSelected={drawBBoxSelected}
display={drawBBoxSelected ? 'fill' : 'empty'}
isDisabled={isWaiting}
/>
</>
)}
@ -145,6 +150,7 @@ export function FeatureEditTools(props: Props) {
aria-pressed={drawPointSelected}
isSelected={drawPointSelected}
display={drawPointSelected ? 'fill' : 'empty'}
isDisabled={isWaiting}
/>
<EuiButtonIcon
className={classNames({
@ -166,6 +172,7 @@ export function FeatureEditTools(props: Props) {
aria-pressed={deleteSelected}
isSelected={deleteSelected}
display={deleteSelected ? 'fill' : 'empty'}
isDisabled={isWaiting}
/>
</EuiPanel>
</TrackApplicationView>

View file

@ -26,7 +26,7 @@ export async function writeDataToIndex(
})
);
}
const settings: WriteSettings = { index, body: data, refresh: true };
const settings: WriteSettings = { index, body: data, refresh: 'wait_for' };
const resp = await asCurrentUser.index(settings);
// @ts-expect-error always false
if (resp.result === 'Error') {

View file

@ -150,7 +150,7 @@ export function initIndexingRoutes({
const resp = await coreContext.elasticsearch.client.asCurrentUser.delete({
index: request.body.index,
id: request.params.featureId,
refresh: true,
refresh: 'wait_for',
});
// @ts-expect-error always false
if (resp.result === 'Error') {