From c9119a3c72d7fb87112f99f33d96f89b0139db04 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 31 Oct 2022 22:16:53 -0700 Subject: [PATCH] Fix inconsistent state with facerect --- src/components/SelectionManager.vue | 8 +++++++- src/components/Timeline.vue | 17 ++++++++++++++++- src/types.ts | 2 ++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/components/SelectionManager.vue b/src/components/SelectionManager.vue index abff9c97..0566cbab 100644 --- a/src/components/SelectionManager.vue +++ b/src/components/SelectionManager.vue @@ -241,7 +241,13 @@ export default class SelectionManager extends Mixins(GlobalMixin, UserConfig) { this.selection.set(photo.fileid, photo); } else { photo.flag &= ~this.c.FLAG_SELECTED; - this.selection.delete(photo.fileid); + + // Only do this if the photo in the selection set is this one. + // The problem arises when there are duplicates (e.g. face rect) + // in the list, which creates an inconsistent state if we do this. + if (this.selection.get(photo.fileid) === photo) { + this.selection.delete(photo.fileid); + } } if (!noUpdate) { diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index 0b58b866..d8180680 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -73,7 +73,7 @@