From 540e2c227e5327a501c8ab46fc8c56d0d4bc27bc Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 26 Nov 2024 19:23:41 +0100 Subject: [PATCH] Fix: fix #2278 --- src/Logic/Tags/And.ts | 4 ++++ src/UI/Popup/DeleteFlow/DeleteWizard.svelte | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Logic/Tags/And.ts b/src/Logic/Tags/And.ts index fa14354993..bf05b3100a 100644 --- a/src/Logic/Tags/And.ts +++ b/src/Logic/Tags/And.ts @@ -18,6 +18,10 @@ export class And extends TagsFilter { console.error("Assertion failed: invalid subtags:", and) throw "Assertion failed: invalid subtags found" } + if (and.some((p) => p === undefined)) { + console.error("Assertion failed: invalid subtags:", and) + throw "Assertion failed: invalid subtags found (undefined)" + } } public static construct(and: ReadonlyArray): TagsFilter diff --git a/src/UI/Popup/DeleteFlow/DeleteWizard.svelte b/src/UI/Popup/DeleteFlow/DeleteWizard.svelte index 22ce4a0aa2..531dbb4c27 100644 --- a/src/UI/Popup/DeleteFlow/DeleteWizard.svelte +++ b/src/UI/Popup/DeleteFlow/DeleteWizard.svelte @@ -61,9 +61,13 @@ const changedProperties = TagUtils.changeAsProperties(selectedTags.asChange(tags?.data ?? {})) const deleteReason = changedProperties[DeleteConfig.deleteReasonKey] if (deleteReason) { - const softDeletionTags= new And([deleteConfig.softDeletionTags, - ...layer.tagRenderings.flatMap(tr => tr.onSoftDelete ?? []) - ]) + + let softDeletionTags: UploadableTag + if(hasSoftDeletion){ + softDeletionTags = new And([deleteConfig.softDeletionTags, + ...layer.tagRenderings.flatMap(tr => tr.onSoftDelete ?? []), + ]) + } // This is a proper, hard deletion actionToTake = new DeleteAction(