mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-10 16:08:52 +01: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');
|
// console.log('onScroll');
|
||||||
if (!scrollableRef.current) return;
|
if (!scrollableRef.current) return;
|
||||||
const { scrollTop } = scrollableRef.current;
|
const { scrollTop } = scrollableRef.current;
|
||||||
states.scrollPositions[id] = scrollTop;
|
if (uiState !== 'loading') {
|
||||||
|
states.scrollPositions[id] = scrollTop;
|
||||||
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
scrollableRef.current.addEventListener('scroll', onScroll, {
|
scrollableRef.current.addEventListener('scroll', onScroll, {
|
||||||
passive: true,
|
passive: true,
|
||||||
|
@ -47,7 +49,7 @@ function StatusPage({ id }) {
|
||||||
return () => {
|
return () => {
|
||||||
scrollableRef.current?.removeEventListener('scroll', onScroll);
|
scrollableRef.current?.removeEventListener('scroll', onScroll);
|
||||||
};
|
};
|
||||||
}, [id]);
|
}, [id, uiState !== 'loading']);
|
||||||
|
|
||||||
const scrollOffsets = useRef();
|
const scrollOffsets = useRef();
|
||||||
const cachedStatusesMap = useRef({});
|
const cachedStatusesMap = useRef({});
|
||||||
|
|
Loading…
Reference in a new issue