diff --git a/package.json b/package.json
index d0f56dd4f2..ccca4937cd 100644
--- a/package.json
+++ b/package.json
@@ -40,7 +40,7 @@
"typescript": "^4.8.4"
},
"dependencies": {
- "@dhis2/analytics": "^26.6.8",
+ "@dhis2/analytics": "^26.6.9",
"@dhis2/app-runtime": "^3.7.0",
"@dhis2/app-runtime-adapter-d2": "^1.1.0",
"@dhis2/app-service-datastore": "^1.0.0-beta.3",
diff --git a/src/components/DimensionsPanel/Dialogs/DialogManager.js b/src/components/DimensionsPanel/Dialogs/DialogManager.js
index e3844578d0..a7f59bbea4 100644
--- a/src/components/DimensionsPanel/Dialogs/DialogManager.js
+++ b/src/components/DimensionsPanel/Dialogs/DialogManager.js
@@ -234,7 +234,7 @@ export class DialogManager extends Component {
// The OU content is persisted as mounted in order
// to cache the org unit tree data
- renderPersistedContent = (dimensionProps) => {
+ renderPersistedContent = (dimensionProps, displayNameProperty) => {
const { ouIds, metadata, parentGraphMap, dialogId } = this.props
if (this.state.ouMounted) {
@@ -253,6 +253,7 @@ export class DialogManager extends Component {
roots={this.props.rootOrgUnits.map(
(rootOrgUnit) => rootOrgUnit.id
)}
+ displayNameProp={displayNameProperty}
{...dimensionProps}
/>
@@ -455,7 +456,10 @@ export class DialogManager extends Component {
return (
- {this.renderPersistedContent(dimensionProps)}
+ {this.renderPersistedContent(
+ dimensionProps,
+ displayNameProperty
+ )}
{dialogId && dynamicContent()}
)
diff --git a/src/components/VisualizationPlugin/VisualizationPlugin.js b/src/components/VisualizationPlugin/VisualizationPlugin.js
index eded3ef3bc..ef87dbac82 100644
--- a/src/components/VisualizationPlugin/VisualizationPlugin.js
+++ b/src/components/VisualizationPlugin/VisualizationPlugin.js
@@ -43,7 +43,7 @@ export const VisualizationPlugin = ({
onDrill,
}) => {
const engine = useDataEngine()
- const [visualization, setVisualization] = useState(undefined)
+ const [visualization, setVisualization] = useState(null)
const [ouLevels, setOuLevels] = useState(undefined)
const [fetchResult, setFetchResult] = useState(null)
const [contextualMenuRef, setContextualMenuRef] = useState(undefined)
@@ -173,6 +173,7 @@ export const VisualizationPlugin = ({
useEffect(() => {
setFetchResult(null)
+ setVisualization(null)
// filter out disabled options
const disabledOptions = getDisabledOptions({
@@ -186,8 +187,6 @@ export const VisualizationPlugin = ({
(option) => delete filteredVisualization[option]
)
- setVisualization(filteredVisualization)
-
const doFetchAll = async () => {
const { responses, extraOptions } = await doFetchData(
filteredVisualization,
@@ -254,6 +253,7 @@ export const VisualizationPlugin = ({
extraOptions,
})
setShowLegendKey(filteredVisualization.legend?.showKey)
+
onLoadingComplete()
}
@@ -264,7 +264,15 @@ export const VisualizationPlugin = ({
/* eslint-disable-next-line react-hooks/exhaustive-deps */
}, [originalVisualization, filters, forDashboard])
- if (!fetchResult || !ouLevels) {
+ useEffect(() => {
+ if (fetchResult?.visualization && ouLevels) {
+ setVisualization(
+ convertOuLevelsToUids(ouLevels, fetchResult.visualization)
+ )
+ }
+ }, [fetchResult?.visualization, ouLevels])
+
+ if (!fetchResult || !visualization || !ouLevels) {
return null
}
@@ -406,10 +414,7 @@ export const VisualizationPlugin = ({
) {
return (