[web] Fix viewer close on deletion of last file (#5405)

This commit is contained in:
Manav Rathi
2025-03-21 17:04:52 +05:30
committed by GitHub
2 changed files with 9 additions and 3 deletions

View File

@@ -73,6 +73,8 @@ services:
configs:
credentials_yaml:
# You'll need to recreate the containers (docker compose down && docker
# compose up) when changing this inline config for the changes to apply.
content: |
db:
host: postgres

View File

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