From ecac129816ee1037cf73b247bc9889d1259235b2 Mon Sep 17 00:00:00 2001 From: Roland Date: Mon, 6 Oct 2025 20:51:26 -0600 Subject: [PATCH] Clearing file preview when user navigates away from preview. --- app/src/components/FilePreview.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/components/FilePreview.js b/app/src/components/FilePreview.js index e49d3b51..c276e92b 100644 --- a/app/src/components/FilePreview.js +++ b/app/src/components/FilePreview.js @@ -193,6 +193,11 @@ export function FilePreviewProvider({children}) { // Navigated to a page which has a file preview active, fetch the information about the file, then display it. if (previewQuery && !previewFile) { initPreviewFile(); + } else if (!previewQuery && (previewFile || previewModal)) { + // User navigated back/forward and preview query is gone, close the preview. + // Only close if there's actually a preview open (previewFile or previewModal exists). + setPreviewFile(null); + setPreviewModal(null); } }, [previewQuery]);