Update MetricContent.tsx

This commit is contained in:
Nate Kelley 2025-08-21 22:28:03 -06:00
parent 25162bac0e
commit b2797ee759
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 5 additions and 1 deletions

View File

@ -25,11 +25,15 @@ export const MetricContent = React.memo(
const reportId = useChatLayoutContextSelector((x) => x.reportId) || '';
const reportVersionNumber = useChatLayoutContextSelector((x) => x.reportVersionNumber);
const ref = useRef<HTMLDivElement>(null);
const hasBeenInViewport = useRef(false);
const [inViewport] = useInViewport(ref, {
threshold: 0.33
});
const renderChart = inViewport || isExportMode;
if (inViewport && !hasBeenInViewport.current) {
hasBeenInViewport.current = true;
}
const renderChart = inViewport || isExportMode || hasBeenInViewport.current;
const {
data: metric,