bugfix scrolling
This commit is contained in:
@@ -471,12 +471,19 @@ export default function Home() {
|
||||
});
|
||||
}, [selectedCategory, selectedRating, priceRange]);
|
||||
|
||||
const prevItemsLength = useRef(items.length);
|
||||
|
||||
useEffect(() => {
|
||||
if (items.length > 0) {
|
||||
setTimeout(() => {
|
||||
containerRef.current?.scrollTo(0, 0);
|
||||
}, 50);
|
||||
if (items.length >= prevItemsLength.current) {
|
||||
prevItemsLength.current = items.length;
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
containerRef.current?.scrollTo(0, 0);
|
||||
}, 50);
|
||||
|
||||
prevItemsLength.current = items.length;
|
||||
}, [items]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user