Merge pull request #5521 from influxdata/5474/dashboard_undefined
fix(dashboard): avoid undefined error when dashboard is not ready yetpull/5529/head
commit
25563b07de
|
@ -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