diff --git a/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsChart/FeatureMetricsChart.tsx b/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsChart/FeatureMetricsChart.tsx index 45d7e6d59b..db8b7ab320 100644 --- a/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsChart/FeatureMetricsChart.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsChart/FeatureMetricsChart.tsx @@ -67,3 +67,6 @@ ChartJS.register( Tooltip, Title ); + +// Use a default export to lazy-load the charting library. +export default FeatureMetricsChart; diff --git a/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsContent/FeatureMetricsContent.tsx b/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsContent/FeatureMetricsContent.tsx index cf2ce958d9..2c3ffe64ee 100644 --- a/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsContent/FeatureMetricsContent.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsContent/FeatureMetricsContent.tsx @@ -1,10 +1,10 @@ import { FeatureMetricsTable } from '../FeatureMetricsTable/FeatureMetricsTable'; import { IFeatureMetricsRaw } from 'interfaces/featureToggle'; import { FeatureMetricsStatsRaw } from '../FeatureMetricsStats/FeatureMetricsStatsRaw'; -import { FeatureMetricsChart } from '../FeatureMetricsChart/FeatureMetricsChart'; import { Box, Typography } from '@mui/material'; import theme from 'themes/theme'; import { useId } from 'hooks/useId'; +import React, { Suspense } from 'react'; interface IFeatureMetricsContentProps { metrics: IFeatureMetricsRaw[]; @@ -34,14 +34,14 @@ export const FeatureMetricsContent = ({ } return ( - <> + - - + ); }; + +const LazyFeatureMetricsChart = React.lazy( + () => import('../FeatureMetricsChart/FeatureMetricsChart') +);