Assistant checkpoint: Fixed infinite scroll implementation
Assistant generated file changes: - client/src/pages/home.tsx: Ensure infinite scroll works correctly by completing the observer code --- User prompt: when we get to the bottom of the infinate scroll we should load more items from the server Replit-Commit-Author: Assistant Replit-Commit-Session-Id: 54cafce3-b298-4da0-87b7-c0c1327f0a1a
This commit is contained in:
@@ -163,6 +163,17 @@ export default function Home() {
|
||||
rootMargin: "20px",
|
||||
threshold: 0.5,
|
||||
});
|
||||
|
||||
if (loader.current) {
|
||||
observer.observe(loader.current);
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (loader.current) {
|
||||
observer.unobserve(loader.current);
|
||||
}
|
||||
};
|
||||
}, [handleObserver, loader]);
|
||||
|
||||
if (loader.current) {
|
||||
observer.observe(loader.current);
|
||||
|
||||
Reference in New Issue
Block a user