Attendance Log Page Resets to First Page After Performing Action on Other Pages.
This commit is contained in:
parent
e485066bd1
commit
a6f5c131a3
@ -146,12 +146,7 @@ const AttendanceLog = ({
|
||||
resetPage,
|
||||
} = usePagination(processedData, 20);
|
||||
|
||||
// Reset to the first page whenever processedData changes (due to switch on/off)
|
||||
useEffect(() => {
|
||||
resetPage();
|
||||
}, [processedData, resetPage]);
|
||||
|
||||
const handler = useCallback(
|
||||
const handler = useCallback(
|
||||
(msg) => {
|
||||
const { startDate, endDate } = dateRange;
|
||||
const checkIn = msg.response.checkInTime.substring(0, 10);
|
||||
@ -167,10 +162,9 @@ const AttendanceLog = ({
|
||||
);
|
||||
|
||||
filtering(updatedAttendance);
|
||||
resetPage();
|
||||
}
|
||||
},
|
||||
[projectId, dateRange, data, filtering, resetPage]
|
||||
[projectId, dateRange, data, filtering] // ✅ removed resetPage from deps
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user