Fix viewer close on deletion of last file

This commit is contained in:
Manav Rathi
2025-03-21 16:56:25 +05:30
parent 0ab2e2834a
commit 5a524fa5b0

View File

@@ -827,8 +827,10 @@ export const FileViewer: React.FC<FileViewerProps> = ({
}, [handleClose, files]); }, [handleClose, files]);
useEffect(() => { useEffect(() => {
psRef.current?.refreshCurrentSlideFavoriteButtonIfNeeded(); if (open) {
}, [favoriteFileIDs, pendingFavoriteUpdates]); psRef.current?.refreshCurrentSlideFavoriteButtonIfNeeded();
}
}, [favoriteFileIDs, pendingFavoriteUpdates, open]);
useEffect(() => { useEffect(() => {
if (open) { if (open) {
@@ -840,7 +842,9 @@ export const FileViewer: React.FC<FileViewerProps> = ({
disableDownload, disableDownload,
haveUser, haveUser,
delegate: delegateRef.current!, delegate: delegateRef.current!,
onClose: handleClose, onClose: () => {
if (psRef.current) handleClose();
},
onAnnotate: handleAnnotate, onAnnotate: handleAnnotate,
onViewInfo: handleViewInfo, onViewInfo: handleViewInfo,
onDownload: handleDownloadBarAction, onDownload: handleDownloadBarAction,