Check for ref before access scrollTop

This commit is contained in:
Lim Chee Aun 2022-12-27 09:05:45 +08:00
parent f7489710a1
commit fb88129ae7

View file

@ -36,6 +36,7 @@ function StatusPage({ id }) {
useEffect(() => {
const onScroll = debounce(() => {
// console.log('onScroll');
if (!scrollableRef.current) return;
const { scrollTop } = scrollableRef.current;
states.scrollPositions.set(id, scrollTop);
}, 100);