Clearing file preview when user navigates away from preview.
Some checks failed
CodeQL / Analyze (push) Has been cancelled

This commit is contained in:
Roland 2025-10-06 20:51:26 -06:00
parent d5116054ca
commit ecac129816
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680

View file

@ -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]);