diff --git a/src/plugins/data/public/ui/dataset_selector/configurator.tsx b/src/plugins/data/public/ui/dataset_selector/configurator.tsx index f90695ab6b84..4db2419bbbd6 100644 --- a/src/plugins/data/public/ui/dataset_selector/configurator.tsx +++ b/src/plugins/data/public/ui/dataset_selector/configurator.tsx @@ -40,8 +40,9 @@ export const Configurator = ({ const type = queryString.getDatasetService().getType(baseDataset.type); const languages = type?.supportedLanguages(baseDataset) || []; + const [dataset, setDataset] = useState(baseDataset); const [timeFields, setTimeFields] = useState(); - const [timeFieldName, setTimeFieldName] = useState(); + const [timeFieldName, setTimeFieldName] = useState(dataset.timeFieldName); const [language, setLanguage] = useState(() => { const currentLanguage = queryString.getQuery().language; if (languages.includes(currentLanguage)) { @@ -94,7 +95,7 @@ export const Configurator = ({ } )} > - + {timeFields && timeFields.length > 0 && ( { const value = e.target.value === 'undefined' ? undefined : e.target.value; setTimeFieldName(value); + setDataset({ ...dataset, timeFieldName: value }); }} /> @@ -136,7 +138,10 @@ export const Configurator = ({ value: languageId, }))} value={language} - onChange={(e) => setLanguage(e.target.value)} + onChange={(e) => { + setLanguage(e.target.value); + setDataset({ ...dataset, language: e.target.value }); + }} /> @@ -156,8 +161,8 @@ export const Configurator = ({ { - queryString.getDatasetService().cacheDataset({ ...dataset, language, timeFieldName }); - onConfirm({ ...dataset, language, timeFieldName }); + queryString.getDatasetService().cacheDataset(dataset); + onConfirm(dataset); }} fill >