Skip to content

Commit

Permalink
fix: Instructors and Students pages are now filtering by institution …
Browse files Browse the repository at this point in the history
…correctly.
  • Loading branch information
sergivalero20 committed Dec 11, 2024
1 parent 9da56e9 commit d8ba650
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
8 changes: 2 additions & 6 deletions src/features/Instructors/InstructorsPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@ const InstructorsPage = () => {

useEffect(() => {
if (Object.keys(selectedInstitution).length > 0) {
dispatch(fetchInstructorsData(selectedInstitution.id, initialPage));
dispatch(fetchInstructorsData(selectedInstitution.id, currentPage, stateInstructors.filters));
}

return () => {
dispatch(resetInstructorsRequest());
};
}, [selectedInstitution, dispatch]); // eslint-disable-line react-hooks/exhaustive-deps

useEffect(() => {
dispatch(fetchInstructorsData(selectedInstitution.id, currentPage, stateInstructors.filters));
}, [currentPage]); // eslint-disable-line react-hooks/exhaustive-deps
}, [selectedInstitution, dispatch, currentPage]); // eslint-disable-line react-hooks/exhaustive-deps

const handlePagination = (targetPage) => {
setCurrentPage(targetPage);
Expand Down
6 changes: 1 addition & 5 deletions src/features/Students/StudentsPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,14 @@ const StudentsPage = () => {

useEffect(() => {
if (Object.keys(selectedInstitution).length > 0) {
dispatch(fetchStudentsData(selectedInstitution.id, initialPage));
dispatch(fetchStudentsData(selectedInstitution.id, currentPage, stateStudents.filters));
}

return () => {
dispatch(resetStudentsTable());
};
}, [selectedInstitution, dispatch]); // eslint-disable-line react-hooks/exhaustive-deps

useEffect(() => {
dispatch(fetchStudentsData(selectedInstitution.id, currentPage, stateStudents.filters));
}, [currentPage]); // eslint-disable-line react-hooks/exhaustive-deps

const resetPagination = () => {
setCurrentPage(initialPage);
};
Expand Down

0 comments on commit d8ba650

Please sign in to comment.