From b0544dc2ef295ea881eaf3ce4c8f2f4e35bd3af1 Mon Sep 17 00:00:00 2001 From: Laurent Senta Date: Mon, 17 Jan 2022 13:59:31 +0100 Subject: [PATCH] fix: typo on parent check (#811) --- .../ui_models/app_state/tags_state.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/ui_models/app_state/tags_state.ts b/app/assets/javascripts/ui_models/app_state/tags_state.ts index ba9325c78..63d3acc1a 100644 --- a/app/assets/javascripts/ui_models/app_state/tags_state.ts +++ b/app/assets/javascripts/ui_models/app_state/tags_state.ts @@ -199,32 +199,33 @@ export class TagsState { public async assignParent( tagUuid: string, - parentUuid: string | undefined + futureParentUuid: string | undefined ): Promise { const tag = this.application.findItem(tagUuid) as SNTag; const currentParent = this.application.getTagParent(tag); - const currentParentUuid = currentParent?.parentId; + const currentParentUuid = currentParent?.uuid; - if (currentParentUuid === parentUuid) { + if (currentParentUuid === futureParentUuid) { return; } - const parent = - parentUuid && (this.application.findItem(parentUuid) as SNTag); + const futureParent = + futureParentUuid && + (this.application.findItem(futureParentUuid) as SNTag); - if (!parent) { + if (!futureParent) { const futureSiblings = rootTags(this.application); if (!isValidFutureSiblings(this.application, futureSiblings, tag)) { return; } await this.application.unsetTagParent(tag); } else { - const futureSiblings = this.application.getTagChildren(parent); + const futureSiblings = this.application.getTagChildren(futureParent); if (!isValidFutureSiblings(this.application, futureSiblings, tag)) { return; } - await this.application.setTagParent(parent, tag); + await this.application.setTagParent(futureParent, tag); } await this.application.sync();