mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-23 01:35:38 +03:00
Don't store scroll position while in loading state
This commit is contained in:
parent
62a3ba7c5f
commit
d7d9d9f0a2
1 changed files with 4 additions and 2 deletions
|
@ -38,7 +38,9 @@ function StatusPage({ id }) {
|
|||
// console.log('onScroll');
|
||||
if (!scrollableRef.current) return;
|
||||
const { scrollTop } = scrollableRef.current;
|
||||
states.scrollPositions[id] = scrollTop;
|
||||
if (uiState !== 'loading') {
|
||||
states.scrollPositions[id] = scrollTop;
|
||||
}
|
||||
}, 100);
|
||||
scrollableRef.current.addEventListener('scroll', onScroll, {
|
||||
passive: true,
|
||||
|
@ -47,7 +49,7 @@ function StatusPage({ id }) {
|
|||
return () => {
|
||||
scrollableRef.current?.removeEventListener('scroll', onScroll);
|
||||
};
|
||||
}, [id]);
|
||||
}, [id, uiState !== 'loading']);
|
||||
|
||||
const scrollOffsets = useRef();
|
||||
const cachedStatusesMap = useRef({});
|
||||
|
|
Loading…
Reference in a new issue