From 2f28b43243500bceff02ddf02b626759a58c8417 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 3 Nov 2021 21:53:27 +0100 Subject: [PATCH] chore: refactor removing a related task --- .../tasks/partials/relatedTasks.vue | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/components/tasks/partials/relatedTasks.vue b/src/components/tasks/partials/relatedTasks.vue index f2c231906..9b50ee692 100644 --- a/src/components/tasks/partials/relatedTasks.vue +++ b/src/components/tasks/partials/relatedTasks.vue @@ -242,19 +242,14 @@ export default { try { await this.taskRelationService.delete(rel) - 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 + const kind = this.relationToDelete.relationKind + for (const t in this.relatedTasks[kind]) { + if (this.relatedTasks[kind][t].id === this.relationToDelete.otherTaskId) { + this.relatedTasks[kind].splice(t, 1) - this.relatedTasks[kind].splice(t, 1) - - break outer - } + break } + } this.saved = true setTimeout(() => { @@ -364,7 +359,7 @@ $remove-icon-width: 24px; } } } - + &:hover .tasks .task .remove { opacity: 1; }