@@ -6,6 +6,7 @@ import type {
66 ChartOptions ,
77 MetricDescription ,
88} from '../../../../../components/MetricChart' ;
9+ import { useGraphShardExists } from '../../../../../store/reducers/capabilities/hooks' ;
910import { cn } from '../../../../../utils/cn' ;
1011import { useAutoRefreshInterval } from '../../../../../utils/hooks' ;
1112
@@ -28,7 +29,13 @@ interface TenantDashboardProps {
2829}
2930
3031export const TenantDashboard = ( { database, charts} : TenantDashboardProps ) => {
31- const [ isDashboardHidden , setIsDashboardHidden ] = React . useState < boolean > ( true ) ;
32+ const graphShardExists = useGraphShardExists ( ) ;
33+
34+ // If GraphShardExists capability is true, show dashboard immediately
35+ // Otherwise, fall back to reactive behavior (hidden until first chart succeeds)
36+ const [ isDashboardHidden , setIsDashboardHidden ] = React . useState < boolean > (
37+ graphShardExists !== true ,
38+ ) ;
3239 const [ autoRefreshInterval ] = useAutoRefreshInterval ( ) ;
3340
3441 // Refetch data only if dashboard successfully loaded
@@ -40,11 +47,13 @@ export const TenantDashboard = ({database, charts}: TenantDashboardProps) => {
4047 * 2. ydb version does not have /viewer/json/render endpoint (400, 404, CORS error, etc.)
4148 *
4249 * If at least one chart successfully loaded, dashboard should be shown
50+ * This fallback behavior is only used when GraphShardExists capability is not available or false
4351 * @link https://github.com/ydb-platform/ydb-embedded-ui/issues/659
4452 * @todo disable only for specific errors ('GraphShard is not enabled') after ydb-stable-24 is generally used
4553 */
4654 const handleChartDataStatusChange = ( chartStatus : ChartDataStatus ) => {
47- if ( chartStatus === 'success' ) {
55+ // Only use reactive behavior when GraphShardExists capability is not true
56+ if ( graphShardExists !== true && chartStatus === 'success' ) {
4857 setIsDashboardHidden ( false ) ;
4958 }
5059 } ;
0 commit comments