From 743abc65994745eff1739b9e7cceea3018562315 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 13 Feb 2022 11:18:19 +0100 Subject: [PATCH] Fix tag editing refreshing with delay Signed-off-by: trivernis --- mediarepo-ui/src-tauri/tauri.conf.json | 2 +- .../shared/sidebar/tag-edit/tag-edit.component.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mediarepo-ui/src-tauri/tauri.conf.json b/mediarepo-ui/src-tauri/tauri.conf.json index 94e187d..34411f0 100644 --- a/mediarepo-ui/src-tauri/tauri.conf.json +++ b/mediarepo-ui/src-tauri/tauri.conf.json @@ -73,4 +73,4 @@ "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self' once: thumb: content:" } } -} \ No newline at end of file +} diff --git a/mediarepo-ui/src/app/components/shared/sidebar/tag-edit/tag-edit.component.ts b/mediarepo-ui/src/app/components/shared/sidebar/tag-edit/tag-edit.component.ts index 06f839c..039a155 100644 --- a/mediarepo-ui/src/app/components/shared/sidebar/tag-edit/tag-edit.component.ts +++ b/mediarepo-ui/src/app/components/shared/sidebar/tag-edit/tag-edit.component.ts @@ -1,6 +1,7 @@ import { AfterViewInit, ChangeDetectionStrategy, + ChangeDetectorRef, Component, EventEmitter, Input, @@ -36,6 +37,7 @@ export class TagEditComponent implements AfterViewInit, OnChanges { private fileTags: { [key: number]: Tag[] } = {}; constructor( + private changeDetector: ChangeDetectorRef, private logger: LoggingService, private tagService: TagService, ) { @@ -63,6 +65,7 @@ export class TagEditComponent implements AfterViewInit, OnChanges { tagInstance = (await this.tagService.createTags([tag]))[0]; this.allTags.push(tagInstance); } + this.changeDetector.markForCheck(); switch (this.editMode) { case "Toggle": await this.toggleTag(tagInstance); @@ -102,6 +105,7 @@ export class TagEditComponent implements AfterViewInit, OnChanges { if (index >= 0) { this.tagScroll.scrollToIndex(index); } + this.changeDetector.markForCheck(); }); this.tagEditEvent.emit(this); } @@ -123,6 +127,7 @@ export class TagEditComponent implements AfterViewInit, OnChanges { } await this.tagService.loadTags(); await this.tagService.loadNamespaces(); + this.changeDetector.markForCheck(); }); this.tagEditEvent.emit(this); } @@ -169,6 +174,7 @@ export class TagEditComponent implements AfterViewInit, OnChanges { this.tags = tags.sort( (a, b) => a.getNormalizedOutput() .localeCompare(b.getNormalizedOutput())); + this.changeDetector.markForCheck(); } private async wrapAsyncOperation(cb: () => Promise): Promise {