From 1d0ca6bb8e485d43dade6d10a1a4a3c074b20911 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 7 Nov 2021 10:40:38 +0100 Subject: [PATCH] Fix tag edit list not refreshing when toggling tags Signed-off-by: trivernis --- mediarepo-ui/src-tauri/Cargo.lock | 4 ++-- mediarepo-ui/src-tauri/Cargo.toml | 2 +- .../app/components/file-edit/file-edit.component.ts | 13 ++----------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/mediarepo-ui/src-tauri/Cargo.lock b/mediarepo-ui/src-tauri/Cargo.lock index 166699c..92c9cff 100644 --- a/mediarepo-ui/src-tauri/Cargo.lock +++ b/mediarepo-ui/src-tauri/Cargo.lock @@ -1580,8 +1580,8 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "mediarepo-api" -version = "0.4.1" -source = "git+https://github.com/Trivernis/mediarepo-api.git?rev=b123e69d92dfd384d37b9005c8e261c69fddfcc5#b123e69d92dfd384d37b9005c8e261c69fddfcc5" +version = "0.4.2" +source = "git+https://github.com/Trivernis/mediarepo-api.git?rev=28b25e94eb2cdb8cec86e3e452081a649b8cd64e#28b25e94eb2cdb8cec86e3e452081a649b8cd64e" dependencies = [ "async-trait", "chrono", diff --git a/mediarepo-ui/src-tauri/Cargo.toml b/mediarepo-ui/src-tauri/Cargo.toml index 59c9b50..959eeca 100644 --- a/mediarepo-ui/src-tauri/Cargo.toml +++ b/mediarepo-ui/src-tauri/Cargo.toml @@ -30,7 +30,7 @@ features = ["env-filter"] [dependencies.mediarepo-api] git = "https://github.com/Trivernis/mediarepo-api.git" -rev = "b123e69d92dfd384d37b9005c8e261c69fddfcc5" +rev = "28b25e94eb2cdb8cec86e3e452081a649b8cd64e" features = ["tauri-plugin"] [features] diff --git a/mediarepo-ui/src/app/components/file-edit/file-edit.component.ts b/mediarepo-ui/src/app/components/file-edit/file-edit.component.ts index a826229..56389b8 100644 --- a/mediarepo-ui/src/app/components/file-edit/file-edit.component.ts +++ b/mediarepo-ui/src/app/components/file-edit/file-edit.component.ts @@ -125,12 +125,7 @@ export class FileEditComponent implements OnInit, OnChanges { [tag.id], []); } } - if (this.tags.findIndex(t => t.getNormalizedOutput() === tag.getNormalizedOutput()) < 0) { - this.tags.push(tag); - this.tags = this.tags.sort( - (a, b) => a.getNormalizedOutput().localeCompare(b.getNormalizedOutput())); - this.tags = [...this.tags]; // angular pls detect it wtf - } + this.mapFileTagsToTagList(); const index = this.tags.indexOf(tag); index >= 0 && this.tagScroll.scrollToIndex(index); } @@ -142,11 +137,7 @@ export class FileEditComponent implements OnInit, OnChanges { [], [tag.id]); } } - const index = this.tags.indexOf(tag); - if (index >= 0) { - this.tags.splice(index, 1); - this.tags = [...this.tags]; // so angular detects the change - } + this.mapFileTagsToTagList(); } private filterSuggestionTag(tag: string) {