From 5e579322ae6cff82a0797d44f719374a3e319734 Mon Sep 17 00:00:00 2001 From: Joel Date: Sat, 8 Feb 2025 14:26:37 +0800 Subject: [PATCH] fix: anchorRef.current may undefined --- web/app/(commonLayout)/datasets/Datasets.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/app/(commonLayout)/datasets/Datasets.tsx b/web/app/(commonLayout)/datasets/Datasets.tsx index ea918a2b17..f4d2156a81 100644 --- a/web/app/(commonLayout)/datasets/Datasets.tsx +++ b/web/app/(commonLayout)/datasets/Datasets.tsx @@ -66,9 +66,9 @@ const Datasets = ({ useEffect(() => { const onScroll = debounce(() => { - if (!loadingStateRef.current) { + if (!loadingStateRef.current && containerRef.current && anchorRef.current) { const { scrollTop, clientHeight } = containerRef.current! - const anchorOffset = anchorRef.current!.offsetTop + const anchorOffset = anchorRef.current.offsetTop if (anchorOffset - scrollTop - clientHeight < 100) setSize(size => size + 1) } @@ -80,7 +80,7 @@ const Datasets = ({ return (