- {basemaps
- .filter((basemap) => layerTypes.includes(basemap.config.type))
- .map((basemap, index) => (
+const BasemapList = ({ selectedID, selectBasemap }) => {
+ const { basemaps } = useCachedDataQuery()
+ return (
+
+ {basemaps.map((basemap, index) => (
(
{...basemap}
/>
))}
-
-)
+
+ )
+}
BasemapList.propTypes = {
- basemaps: PropTypes.array.isRequired,
selectBasemap: PropTypes.func.isRequired,
selectedID: PropTypes.string.isRequired,
}
diff --git a/src/components/layers/download/DataDownloadDialog.js b/src/components/layers/download/DataDownloadDialog.js
index e11eea667..af9c320ab 100644
--- a/src/components/layers/download/DataDownloadDialog.js
+++ b/src/components/layers/download/DataDownloadDialog.js
@@ -1,3 +1,4 @@
+import { useCachedDataQuery } from '@dhis2/analytics'
import { useD2 } from '@dhis2/app-runtime-adapter-d2'
import i18n from '@dhis2/d2-i18n'
import {
@@ -13,12 +14,11 @@ import { useSelector } from 'react-redux'
import { EVENT_LAYER } from '../../../constants/layers.js'
import { getFormatOptions, downloadData } from '../../../util/dataDownload.js'
import { SelectField, Checkbox, Help } from '../../core/index.js'
-import { useUserSettings } from '../../UserSettingsProvider.js'
import DataDownloadDialogActions from './DataDownloadDialogActions.js'
import styles from './styles/DataDownloadDialog.module.css'
const DataDownloadDialog = ({ layer, onCloseDialog }) => {
- const { keyAnalysisDisplayProperty } = useUserSettings()
+ const { nameProperty } = useCachedDataQuery()
const formatOptions = getFormatOptions()
const { d2 } = useD2()
const [selectedFormat, setSelectedFormat] = useState(formatOptions[2])
@@ -53,7 +53,7 @@ const DataDownloadDialog = ({ layer, onCloseDialog }) => {
format: selectedFormat.id,
humanReadableKeys: humanReadable,
d2,
- nameProperty: keyAnalysisDisplayProperty,
+ nameProperty,
})
setIsDownloading(false)
onClose()
diff --git a/src/components/layers/overlays/AddLayerPopover.js b/src/components/layers/overlays/AddLayerPopover.js
index 261a04d2c..dca19f96d 100644
--- a/src/components/layers/overlays/AddLayerPopover.js
+++ b/src/components/layers/overlays/AddLayerPopover.js
@@ -1,3 +1,4 @@
+import { useCachedDataQuery } from '@dhis2/analytics'
import { Popover } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'
@@ -9,12 +10,12 @@ import LayerList from './LayerList.js'
const AddLayerPopover = ({
anchorEl,
- layers = [],
isSplitView,
addLayer,
editLayer,
onClose,
}) => {
+ const { layerTypes } = useCachedDataQuery()
const onLayerSelect = (layer) => {
const config = { ...layer }
layer.layer === EXTERNAL_LAYER ? addLayer(config) : editLayer(config)
@@ -31,7 +32,7 @@ const AddLayerPopover = ({
dataTest="addlayerpopover"
>