From 33ab69e010a2cace520826f12cbd0e80a7bc0832 Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 5 Mar 2022 19:42:49 -0800 Subject: [PATCH 1/2] Clone tags array to prevent false dirty check Closes #215 --- .../app/components/document-detail/document-detail.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts index 85b221307..22c63ccc4 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.ts @@ -146,7 +146,7 @@ export class DocumentDetailComponent implements OnInit, OnDestroy, DirtyComponen correspondent: doc.correspondent, document_type: doc.document_type, archive_serial_number: doc.archive_serial_number, - tags: doc.tags + tags: [...doc.tags] }) this.isDirty$ = dirtyCheck(this.documentForm, this.store.asObservable()) From b383e7dd08148a6c2522d19978ba4b25cff06109 Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 5 Mar 2022 20:09:44 -0800 Subject: [PATCH 2/2] Reduce debounce to avoid title erasing Closes #216 --- .../components/document-detail/document-detail.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts index 22c63ccc4..e751f59f8 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.ts @@ -94,10 +94,11 @@ export class DocumentDetailComponent implements OnInit, OnDestroy, DirtyComponen private toastService: ToastService, private settings: SettingsService) { this.titleSubject.pipe( - debounceTime(200), + debounceTime(1000), distinctUntilChanged(), takeUntil(this.unsubscribeNotifier) ).subscribe(titleValue => { + this.title = titleValue this.documentForm.patchValue({'title': titleValue}) }) }