fix(dashboard): avoid undefined error when dashboard is not ready yet
parent
71b9d07f4f
commit
9639fc469b
|
@ -27,6 +27,10 @@ export const updateDashboardLinks = (
|
|||
) => {
|
||||
const {active} = dashboardLinks
|
||||
|
||||
if (!activeDashboard) {
|
||||
return {...dashboardLinks, active: null}
|
||||
}
|
||||
|
||||
if (!active || active.key !== String(activeDashboard.id)) {
|
||||
return updateActiveDashboardLink(dashboardLinks, activeDashboard)
|
||||
}
|
||||
|
@ -38,10 +42,6 @@ const updateActiveDashboardLink = (
|
|||
dashboardLinks: DashboardSwitcherLinks,
|
||||
dashboard: Dashboard
|
||||
) => {
|
||||
if (!dashboard) {
|
||||
return {...dashboardLinks, active: null}
|
||||
}
|
||||
|
||||
const active = dashboardLinks.links.find(
|
||||
link => link.key === String(dashboard.id)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue