From 03083be626855b202e12315a97ce18f295676925 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Wed, 9 Aug 2023 14:21:43 +0530 Subject: [PATCH] chore: fix file preview modal vault selection --- .../javascripts/Controllers/FilePreviewModalController.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/web/src/javascripts/Controllers/FilePreviewModalController.ts b/packages/web/src/javascripts/Controllers/FilePreviewModalController.ts index f0e7e670d..4bea51dcb 100644 --- a/packages/web/src/javascripts/Controllers/FilePreviewModalController.ts +++ b/packages/web/src/javascripts/Controllers/FilePreviewModalController.ts @@ -24,8 +24,9 @@ export class FilePreviewModalController { if (!this.currentFile) { return } - if (changed.includes(this.currentFile)) { - this.setCurrentFile(this.currentFile) + const changedCurrentFile = changed.find((f) => f.uuid === this.currentFile?.uuid) as FileItem | undefined + if (changedCurrentFile) { + this.setCurrentFile(changedCurrentFile) } if (removed.find((f) => f.uuid === this.currentFile?.uuid)) { if (!this.otherFiles.length) {