From 8e4ecd242b5c50357193b2b9bcf6b0d139b74093 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 20 Feb 2023 20:59:46 +0800 Subject: [PATCH] Revert flush to cancel, speed up scroll position caching Somehow the flush cache the scroll position for a different status ID --- src/pages/status.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/status.jsx b/src/pages/status.jsx index 10ab7071..c22e6bc0 100644 --- a/src/pages/status.jsx +++ b/src/pages/status.jsx @@ -62,13 +62,13 @@ function StatusPage() { if (uiState !== 'loading') { states.scrollPositions[id] = scrollTop; } - }, 100); + }, 50); scrollableRef.current.addEventListener('scroll', onScroll, { passive: true, }); onScroll(); return () => { - onScroll.flush(); + onScroll.cancel(); scrollableRef.current?.removeEventListener('scroll', onScroll); }; }, [id, uiState !== 'loading']);