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 authored Oct 9, 2020
1 parent fe2a14a commit 05a8413
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 05a8413

Please sign in to comment.