size report based on table

This commit is contained in:
Nate Kelley 2025-09-23 16:55:55 -06:00
parent 96b721e7bf
commit d3938e7d6b
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 7 additions and 3 deletions

View File

@ -11,8 +11,8 @@ import {
withHOC,
} from 'platejs/react';
import React, { type PropsWithChildren, useCallback, useMemo, useRef } from 'react';
import type { BusterMetric } from '@/api/asset_interfaces/metric';
import { useGetMetric } from '@/api/buster_rest/metrics';
import type { BusterMetric, BusterMetricData } from '@/api/asset_interfaces/metric';
import { useGetMetric, useGetMetricData } from '@/api/buster_rest/metrics';
import { useSize } from '@/hooks/useSize';
import { cn } from '@/lib/classMerge';
import { GlobalVariablePlugin } from '../../plugins/global-variable-kit';
@ -41,7 +41,11 @@ export const MetricElement = withHOC(
{ id: metricId },
{ select: useCallback((x: BusterMetric) => x?.chart_config?.selectedChartType, []) }
);
const isTable = selectedChartType === 'table';
const { isFetched: isFetchedMetricData } = useGetMetricData(
{ id: metricId },
{ select: useCallback((x: BusterMetricData) => x, []) }
);
const isTable = selectedChartType === 'table' && isFetchedMetricData;
const content = metricId ? (
<MetricToolbar selectedMetricId={metricId}>