mirror of https://github.com/buster-so/buster.git
Update MetricContent.tsx
This commit is contained in:
parent
25162bac0e
commit
b2797ee759
|
@ -25,11 +25,15 @@ export const MetricContent = React.memo(
|
||||||
const reportId = useChatLayoutContextSelector((x) => x.reportId) || '';
|
const reportId = useChatLayoutContextSelector((x) => x.reportId) || '';
|
||||||
const reportVersionNumber = useChatLayoutContextSelector((x) => x.reportVersionNumber);
|
const reportVersionNumber = useChatLayoutContextSelector((x) => x.reportVersionNumber);
|
||||||
const ref = useRef<HTMLDivElement>(null);
|
const ref = useRef<HTMLDivElement>(null);
|
||||||
|
const hasBeenInViewport = useRef(false);
|
||||||
|
|
||||||
const [inViewport] = useInViewport(ref, {
|
const [inViewport] = useInViewport(ref, {
|
||||||
threshold: 0.33
|
threshold: 0.33
|
||||||
});
|
});
|
||||||
const renderChart = inViewport || isExportMode;
|
if (inViewport && !hasBeenInViewport.current) {
|
||||||
|
hasBeenInViewport.current = true;
|
||||||
|
}
|
||||||
|
const renderChart = inViewport || isExportMode || hasBeenInViewport.current;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: metric,
|
data: metric,
|
||||||
|
|
Loading…
Reference in New Issue