From 82a2d37297f39d93ebd33a484669f7fb1c8700c0 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Fri, 9 Oct 2020 14:02:36 +0200 Subject: [PATCH] fix: check whether the dashboard id has been set after the check for existing dashboards [DHIS2-9738] (#1164) The state checks need to happen in a certain order, unfortunately. In an empty database, the id never gets set, resulting in an infinite circular loader. So that check needs to happen after the check for existing dashboards. In an empty database, there are no dashboards. --- src/components/Dashboard/Dashboard.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/Dashboard/Dashboard.js b/src/components/Dashboard/Dashboard.js index 0970e0b3e..29516ad19 100644 --- a/src/components/Dashboard/Dashboard.js +++ b/src/components/Dashboard/Dashboard.js @@ -81,7 +81,7 @@ export const Dashboard = ({ } }, []) - if (!dashboardsLoaded || id === null) { + if (!dashboardsLoaded) { return ( @@ -121,6 +121,16 @@ export const Dashboard = ({ ) } + if (id === null) { + return ( + + + + + + ) + } + return dashboardMap[mode] }