diff --git a/client/src/components/FiltersSideMenu/filters.js b/client/src/components/FiltersSideMenu/filters.js index d41fefb..f78bd3a 100644 --- a/client/src/components/FiltersSideMenu/filters.js +++ b/client/src/components/FiltersSideMenu/filters.js @@ -26,6 +26,28 @@ export default function SearchTabFilters({ locations, achievements }) { const [locationsData, setLocationsData] = useState(locations); const [achievementsData, setAchievementsData] = useState(achievements); + /** + * Component unmount trigger + */ + useEffect(() => { + return () => { + console.log("filters unmounted..."); + handleReset(); + }; + }, []); + + const handleReset = () => { + search.selectLocations([]); + search.selectSkills([]); + search.selectAchievements([]); + search.selectAvailability({ + isAvailableSelected: false, + isUnavailableSelected: false, + }); + search.selectCompanyAttributes({}); + search.changePageNumber(1); + }; + useEffect(() => { setLocationsData(locations); setAchievementsData(achievements); @@ -202,7 +224,10 @@ export default function SearchTabFilters({ locations, achievements }) { return (