fix(dashboard): notification list scroll flickering (#11911)
* fix: flicekring of the notification list due to rerendering * fix: revert page size * fix: page size * fix: reintroduce treshold * fix: param * fix: revert page size
This commit is contained in:
@@ -74,17 +74,27 @@ export const InfiniteList = <
|
|||||||
// Define the new observers after we stop fetching
|
// Define the new observers after we stop fetching
|
||||||
if (!isFetching) {
|
if (!isFetching) {
|
||||||
// Define the new observers after paginating
|
// Define the new observers after paginating
|
||||||
startObserver.current = new IntersectionObserver((entries) => {
|
startObserver.current = new IntersectionObserver(
|
||||||
if (entries[0].isIntersecting && hasPreviousPage) {
|
(entries) => {
|
||||||
fetchPreviousPage()
|
if (entries[0].isIntersecting && hasPreviousPage) {
|
||||||
|
fetchPreviousPage()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
threshold: 0.5,
|
||||||
}
|
}
|
||||||
})
|
)
|
||||||
|
|
||||||
endObserver.current = new IntersectionObserver((entries) => {
|
endObserver.current = new IntersectionObserver(
|
||||||
if (entries[0].isIntersecting && hasNextPage) {
|
(entries) => {
|
||||||
fetchNextPage()
|
if (entries[0].isIntersecting && hasNextPage) {
|
||||||
|
fetchNextPage()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
threshold: 0.5,
|
||||||
}
|
}
|
||||||
})
|
)
|
||||||
|
|
||||||
// Register the new observers to observe the new first and last children
|
// Register the new observers to observe the new first and last children
|
||||||
startObserver.current?.observe(parentRef.current!.firstChild as Element)
|
startObserver.current?.observe(parentRef.current!.firstChild as Element)
|
||||||
|
|||||||
Reference in New Issue
Block a user