From 88e8d270d16322e491f265dfd12cd4db1f196253 Mon Sep 17 00:00:00 2001 From: Mert Sincan Date: Fri, 20 Dec 2024 08:56:05 +0000 Subject: [PATCH] Refactor #7516 --- components/lib/virtualscroller/VirtualScroller.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/lib/virtualscroller/VirtualScroller.js b/components/lib/virtualscroller/VirtualScroller.js index 34ca38f24c..740c3d96a5 100644 --- a/components/lib/virtualscroller/VirtualScroller.js +++ b/components/lib/virtualscroller/VirtualScroller.js @@ -549,9 +549,13 @@ export const VirtualScroller = React.memo( }; const isVisible = () => { - const rect = elementRef.current.getBoundingClientRect(); + if (DomHandler.isVisible(elementRef.current)) { + const rect = elementRef.current.getBoundingClientRect(); - return rect.width > 0 && rect.height > 0; + return rect.width > 0 && rect.height > 0; + } + + return false; }; React.useEffect(() => {