diff --git a/src/reducers/src/combined-updaters.ts b/src/reducers/src/combined-updaters.ts index e4443b6e74..cba9e01ed8 100644 --- a/src/reducers/src/combined-updaters.ts +++ b/src/reducers/src/combined-updaters.ts @@ -120,7 +120,8 @@ export const isValidConfig = config => export const defaultAddDataToMapOptions = { centerMap: true, keepExistingConfig: false, - autoCreateLayers: true + autoCreateLayers: true, + autoCreateTooltips: true }; /** diff --git a/src/reducers/src/vis-state-updaters.ts b/src/reducers/src/vis-state-updaters.ts index a7461b75d5..1f1141444f 100644 --- a/src/reducers/src/vis-state-updaters.ts +++ b/src/reducers/src/vis-state-updaters.ts @@ -1878,7 +1878,12 @@ function postMergeUpdater(mergedState: VisState, postMergerPayload: PostMergerPa // if no tooltips merged add default tooltips newDataIds.forEach(dataId => { const tooltipFields = mergedState.interactionConfig.tooltip.config.fieldsToShow[dataId]; - if (!Array.isArray(tooltipFields) || !tooltipFields.length) { + // loading dataset: autoCreateTooltips is false and we don't want to run addDefaultTooltips when tooltipFields is empty + if ( + options?.autoCreateTooltips !== false && + (!Array.isArray(tooltipFields) || !tooltipFields.length) + ) { + // adding dataset: autoCreateTooltips is true mergedState = addDefaultTooltips(mergedState, newDataEntries[dataId]); } }); diff --git a/src/types/actions.d.ts b/src/types/actions.d.ts index 373253b720..8c96a77962 100644 --- a/src/types/actions.d.ts +++ b/src/types/actions.d.ts @@ -58,6 +58,7 @@ export type AddDataToMapOptions = { readOnly?: boolean; keepExistingConfig?: boolean; autoCreateLayers?: boolean; + autoCreateTooltips?: boolean; }; export type AddDataToMapPayload = {