Infinite Scroll: Another attempt to fix a weird bug with missing chats
This commit is contained in:
parent
17444bd9f7
commit
99cfeb6e09
@ -92,10 +92,6 @@ const InfiniteScroll: FC<OwnProps> = ({
|
|||||||
|
|
||||||
state.listItemElements = container.querySelectorAll<HTMLDivElement>(itemSelector);
|
state.listItemElements = container.querySelectorAll<HTMLDivElement>(itemSelector);
|
||||||
|
|
||||||
if (noScrollRestore) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let newScrollTop;
|
let newScrollTop;
|
||||||
|
|
||||||
if (state.currentAnchor && Array.from(state.listItemElements).includes(state.currentAnchor)) {
|
if (state.currentAnchor && Array.from(state.listItemElements).includes(state.currentAnchor)) {
|
||||||
@ -104,12 +100,16 @@ const InfiniteScroll: FC<OwnProps> = ({
|
|||||||
newScrollTop = scrollTop + (newAnchorTop - state.currentAnchorTop);
|
newScrollTop = scrollTop + (newAnchorTop - state.currentAnchorTop);
|
||||||
} else {
|
} else {
|
||||||
const nextAnchor = state.listItemElements[0];
|
const nextAnchor = state.listItemElements[0];
|
||||||
if (nextAnchor && nextAnchor.offsetParent) {
|
if (nextAnchor) {
|
||||||
state.currentAnchor = nextAnchor;
|
state.currentAnchor = nextAnchor;
|
||||||
state.currentAnchorTop = nextAnchor.getBoundingClientRect().top;
|
state.currentAnchorTop = nextAnchor.getBoundingClientRect().top;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (noScrollRestore) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
resetScroll(container, newScrollTop);
|
resetScroll(container, newScrollTop);
|
||||||
|
|
||||||
state.isScrollTopJustUpdated = true;
|
state.isScrollTopJustUpdated = true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user