From bf1fc85681dbb3e70ace204d464ae40c2316fa22 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Fri, 19 Apr 2024 16:14:20 +0200 Subject: [PATCH] fix: use displayName and displayShortName to get correct name --- src/components/UserSettingsProvider.js | 4 +++- src/modules/useDimensions.js | 6 +++--- src/pages/view/TitleBar/FilterDialog.js | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/UserSettingsProvider.js b/src/components/UserSettingsProvider.js index 393a9eb31..bf451a501 100644 --- a/src/components/UserSettingsProvider.js +++ b/src/components/UserSettingsProvider.js @@ -17,7 +17,9 @@ const UserSettingsProvider = ({ children }) => { setSettings({ ...userSettings, - displayProperty: userSettings.keyAnalysisDisplayProperty, + displayProperty: userSettings.keyAnalysisDisplayProperty === 'name' + ? 'displayName' + : 'displayShortName', }) } fetchData() diff --git a/src/modules/useDimensions.js b/src/modules/useDimensions.js index ad81b7400..f0efb0558 100644 --- a/src/modules/useDimensions.js +++ b/src/modules/useDimensions.js @@ -17,7 +17,7 @@ const useDimensions = (doFetch) => { try { const unfilteredDimensions = await apiFetchDimensions( dataEngine, - userSettings.keyAnalysisDisplayProperty + userSettings.displayProperty ) dispatch( @@ -31,11 +31,11 @@ const useDimensions = (doFetch) => { if ( !dimensions.length && doFetch && - userSettings.keyAnalysisDisplayProperty + userSettings.displayProperty ) { fetchDimensions() } - }, [dimensions, doFetch, userSettings.keyAnalysisDisplayProperty]) + }, [dimensions, doFetch, userSettings.displayProperty, dispatch, dataEngine]) return dimensions } diff --git a/src/pages/view/TitleBar/FilterDialog.js b/src/pages/view/TitleBar/FilterDialog.js index 0cb807089..8ea09b116 100644 --- a/src/pages/view/TitleBar/FilterDialog.js +++ b/src/pages/view/TitleBar/FilterDialog.js @@ -120,7 +120,7 @@ const FilterDialog = ({ onSelect={onSelectItems} dimensionTitle={dimension.name} displayNameProp={ - userSettings.keyAnalysisDisplayProperty + userSettings.displayProperty } /> )