diff --git a/src/components/FileInfoPopup/FileInfoPopup.tsx b/src/components/FileInfoPopup/FileInfoPopup.tsx index 26d435d..d2b8c6d 100644 --- a/src/components/FileInfoPopup/FileInfoPopup.tsx +++ b/src/components/FileInfoPopup/FileInfoPopup.tsx @@ -1,4 +1,4 @@ -import { useMemo } from "react"; +import { useEffect, useMemo } from "react"; import { useAppDispatch, useAppSelector } from "../../hooks/store"; import { downloadFileAPI } from "../../api/filesAPI"; import CloseIcon from "../../icons/CloseIcon"; @@ -52,6 +52,17 @@ const FileInfoPopup = () => { dispatch(resetPopupSelect()); }; + useEffect(() => { + const handleBack = () => { + dispatch(resetPopupSelect()); + }; + window.addEventListener("popstate", handleBack); + + return () => { + window.removeEventListener("popstate", handleBack); + }; + }, []); + return (