mirror of https://github.com/buster-so/buster.git
size report based on table
This commit is contained in:
parent
96b721e7bf
commit
d3938e7d6b
|
@ -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}>
|
||||
|
|
Loading…
Reference in New Issue