@@ -394,19 +394,8 @@ function InnerWrapper({ children, project, dashboardName }) {
394394 const DEFAULT_DASHBOARD_DURATION = '30m' ;
395395 const DEFAULT_REFRESH_INTERVAL = '0s' ;
396396
397- let clearedDashboardResource : DashboardResource | undefined ;
398- if ( Array . isArray ( persesDashboard ) ) {
399- if ( persesDashboard . length === 0 ) {
400- clearedDashboardResource = undefined ;
401- } else {
402- clearedDashboardResource = persesDashboard [ 0 ] ;
403- }
404- } else {
405- clearedDashboardResource = persesDashboard ;
406- }
407-
408- const dashboardDuration = clearedDashboardResource ?. spec ?. duration ;
409- const dashboardTimeInterval = clearedDashboardResource ?. spec ?. refreshInterval ;
397+ const dashboardDuration = persesDashboard ?. spec ?. duration ;
398+ const dashboardTimeInterval = persesDashboard ?. spec ?. refreshInterval ;
410399
411400 const effectiveDuration = dashboardDuration || DEFAULT_DASHBOARD_DURATION ;
412401 const effectiveRefreshInterval = dashboardTimeInterval || DEFAULT_REFRESH_INTERVAL ;
@@ -460,17 +449,14 @@ function InnerWrapper({ children, project, dashboardName }) {
460449 >
461450 < VariableProviderWithQueryParams
462451 builtinVariableDefinitions = { builtinVariables }
463- initialVariableDefinitions = { clearedDashboardResource ?. spec ?. variables }
464- key = { clearedDashboardResource ?. metadata . name }
452+ initialVariableDefinitions = { persesDashboard ?. spec ?. variables }
453+ key = { persesDashboard ?. metadata . name }
465454 >
466- < PersesPrometheusDatasourceWrapper
467- queries = { [ ] }
468- dashboardResource = { clearedDashboardResource }
469- >
470- { clearedDashboardResource ? (
455+ < PersesPrometheusDatasourceWrapper queries = { [ ] } dashboardResource = { persesDashboard } >
456+ { persesDashboard ? (
471457 < DashboardProvider
472458 initialState = { {
473- dashboardResource : clearedDashboardResource ,
459+ dashboardResource : persesDashboard ,
474460 } }
475461 >
476462 < ValidationProvider > { children } </ ValidationProvider >
0 commit comments