From 5a7398a7af9ed048fd4fa871f2716f7763de165c Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 6 Aug 2020 13:10:50 -0600 Subject: [PATCH] update navigation_panel snapshot --- .../maps/public/actions/data_request_actions.ts | 9 +++++---- .../__snapshots__/navigation_panel.test.tsx.snap | 12 ++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/maps/public/actions/data_request_actions.ts b/x-pack/plugins/maps/public/actions/data_request_actions.ts index f6b8d212faf7b..a22e8d582bc5e 100644 --- a/x-pack/plugins/maps/public/actions/data_request_actions.ts +++ b/x-pack/plugins/maps/public/actions/data_request_actions.ts @@ -381,15 +381,16 @@ export function fitToDataBounds(onNoBounds?: () => void) { let lastSetQueryCallId: string = ''; export function autoFitToBounds() { return async (dispatch: Dispatch) => { + // Method can be triggered before async actions complete + // Use localSetQueryCallId to only continue execution path if method has not been re-triggered. + const localSetQueryCallId = uuid(); + lastSetQueryCallId = localSetQueryCallId; + // Joins are performed on the client. // As a result, bounds for join layers must also be performed on the client. // Therefore join layers need to fetch data prior to auto fitting bounds. - const localSetQueryCallId = uuid(); - lastSetQueryCallId = localSetQueryCallId; await dispatch(syncDataForAllJoinLayers()); - // autoFitToBounds can be triggered before async data fetching completes - // Only continue execution path if autoFitToBounds has not been re-triggered. if (localSetQueryCallId === lastSetQueryCallId) { // In cases where there are no bounds, such as no matching documents, fitToDataBounds does not trigger setGotoWithBounds. // Ensure layer syncing occurs when setGotoWithBounds is not triggered. diff --git a/x-pack/plugins/maps/public/connected_components/map_settings_panel/__snapshots__/navigation_panel.test.tsx.snap b/x-pack/plugins/maps/public/connected_components/map_settings_panel/__snapshots__/navigation_panel.test.tsx.snap index 18e30d9446e05..1859c7d8177f8 100644 --- a/x-pack/plugins/maps/public/connected_components/map_settings_panel/__snapshots__/navigation_panel.test.tsx.snap +++ b/x-pack/plugins/maps/public/connected_components/map_settings_panel/__snapshots__/navigation_panel.test.tsx.snap @@ -75,6 +75,10 @@ exports[`should render 1`] = ` "id": "LAST_SAVED_LOCATION", "label": "Map location at save", }, + Object { + "id": "AUTO_FIT_TO_BOUNDS", + "label": "Auto fit map to data bounds", + }, Object { "id": "FIXED_LOCATION", "label": "Fixed location", @@ -165,6 +169,10 @@ exports[`should render browser location form when initialLocation is BROWSER_LOC "id": "LAST_SAVED_LOCATION", "label": "Map location at save", }, + Object { + "id": "AUTO_FIT_TO_BOUNDS", + "label": "Auto fit map to data bounds", + }, Object { "id": "FIXED_LOCATION", "label": "Fixed location", @@ -275,6 +283,10 @@ exports[`should render fixed location form when initialLocation is FIXED_LOCATIO "id": "LAST_SAVED_LOCATION", "label": "Map location at save", }, + Object { + "id": "AUTO_FIT_TO_BOUNDS", + "label": "Auto fit map to data bounds", + }, Object { "id": "FIXED_LOCATION", "label": "Fixed location",