From bb4abd6a1e006e3ea7754f8edec3f901bebd432e Mon Sep 17 00:00:00 2001 From: olivierdalang Date: Thu, 28 Apr 2022 12:31:09 +0200 Subject: [PATCH 1/2] fix map staying blank if no permissions on default theme --- components/StandardApp.jsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/StandardApp.jsx b/components/StandardApp.jsx index 21c1d92ac..edd2f4f2b 100644 --- a/components/StandardApp.jsx +++ b/components/StandardApp.jsx @@ -94,6 +94,20 @@ class AppInitComponent extends React.Component { if (ConfigUtils.getConfigProp("dontLoadDefaultTheme")) { return; } + + // Determine default theme, and fallback if not available + let availableThemes = themes.items.map((t) => t.id); + let defaultTheme = themes.defaultTheme; + if (!availableThemes.includes(themes.defaultTheme)) { + console.log(`Default theme (${themes.defaultTheme}) is not available.`); + if (availableThemes.length > 0) { + defaultTheme = themes.items[0].id; + console.log(`Falling back to ${defaultTheme}.`); + } else { + console.log(`No available theme to fallback to.`); + } + } + theme = ThemeUtils.getThemeById(themes, themes.defaultTheme); } const layerParams = params.l !== undefined ? params.l.split(",").filter(entry => entry) : null; From 426a40a9304148cb47f68bb40c6875ddf5b1d9ad Mon Sep 17 00:00:00 2001 From: olivierdalang Date: Mon, 23 May 2022 10:03:32 +0200 Subject: [PATCH 2/2] fix map staying blank if no permissions on default theme followup --- components/StandardApp.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/StandardApp.jsx b/components/StandardApp.jsx index edd2f4f2b..17573dc22 100644 --- a/components/StandardApp.jsx +++ b/components/StandardApp.jsx @@ -108,7 +108,7 @@ class AppInitComponent extends React.Component { } } - theme = ThemeUtils.getThemeById(themes, themes.defaultTheme); + theme = ThemeUtils.getThemeById(themes, defaultTheme); } const layerParams = params.l !== undefined ? params.l.split(",").filter(entry => entry) : null; if (layerParams && ConfigUtils.getConfigProp("urlReverseLayerOrder")) {