From 21ddd257147d6cc3d8e461fff5841b8c741f60f0 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 2 Nov 2021 20:18:34 +0100 Subject: [PATCH] fix: related task not removed from the list when deleting it --- .../tasks/partials/relatedTasks.vue | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/components/tasks/partials/relatedTasks.vue b/src/components/tasks/partials/relatedTasks.vue index 89905a252..772d2dc06 100644 --- a/src/components/tasks/partials/relatedTasks.vue +++ b/src/components/tasks/partials/relatedTasks.vue @@ -244,15 +244,19 @@ export default { try { await this.taskRelationService.delete(rel) - Object.entries(this.relatedTasks).some(([relationKind, t]) => { - const found = typeof this.relatedTasks[relationKind][t] !== 'undefined' && - this.relatedTasks[relationKind][t].id === this.relationToDelete.otherTaskId && - relationKind === this.relationToDelete.relationKind - if (!found) return false + outer: + for (const kind in this.relatedTasks) { + for (const t in this.relatedTasks[kind]) { + const found = typeof this.relatedTasks[kind][t] !== 'undefined' && + this.relatedTasks[kind][t].id === this.relationToDelete.otherTaskId && + kind === this.relationToDelete.relationKind + if (!found) continue - this.relatedTasks[relationKind].splice(t, 1) - return true - }) + this.relatedTasks[kind].splice(t, 1) + + break outer + } + } this.saved = true setTimeout(() => {