Skip to content

Commit

Permalink
fix: check whether the dashboard id has been set after the check for …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
jenniferarnesen committed Oct 9, 2020
1 parent 3dbfd7e commit 194560b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/Dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const Dashboard = ({
}
}, [])

if (!dashboardsLoaded || id === null) {
if (!dashboardsLoaded) {
return (
<Layer translucent>
<CenteredContent>
Expand Down Expand Up @@ -121,6 +121,16 @@ export const Dashboard = ({
)
}

if (id === null) {
return (
<Layer translucent>
<CenteredContent>
<CircularLoader />
</CenteredContent>
</Layer>
)
}

return dashboardMap[mode]
}

Expand Down

0 comments on commit 194560b

Please sign in to comment.