react-query-v2 : react-query intergrated inside attendance and gallery module #270

Merged
vikas.nale merged 16 commits from react-query-v2 into main 2025-07-24 09:41:21 +00:00
Showing only changes of commit 89085d5069 - Show all commits

View File

@ -106,24 +106,27 @@ const ImageGallery = () => {
return () => eventBus.off("image_gallery", handler); return () => eventBus.off("image_gallery", handler);
}, [selectedProjectId, refetch]); }, [selectedProjectId, refetch]);
useEffect(() => { useEffect(() => {
if (!loaderRef.current) return; if (!loaderRef.current) return;
const obs = new IntersectionObserver(
([entry]) => { const observer = new IntersectionObserver(
if ( ([entry]) => {
entry.isIntersecting && if (entry.isIntersecting && hasNextPage && !isFetchingNextPage && !isLoading) {
hasNextPage && fetchNextPage();
!isFetchingNextPage && }
!isLoading },
) { { rootMargin: "200px", threshold: 0.1 }
fetchNextPage(); );
}
}, observer.observe(loaderRef.current);
{ rootMargin: "200px", threshold: 0.1 }
); return () => {
obs.observe(loaderRef.current); if (loaderRef.current) {
return () => obs.unobserve(loaderRef.current); observer.unobserve(loaderRef.current);
}, [hasNextPage, isFetchingNextPage, isLoading, fetchNextPage]); }
};
}, [hasNextPage, isFetchingNextPage, isLoading, fetchNextPage]);
// Utility: derive filter options // Utility: derive filter options
const getUniqueValues = useCallback( const getUniqueValues = useCallback(