mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Fix title subscription fires even after doc change
This commit is contained in:
		| @@ -85,6 +85,7 @@ export class DocumentDetailComponent | ||||
|   store: BehaviorSubject<any> | ||||
|   isDirty$: Observable<boolean> | ||||
|   unsubscribeNotifier: Subject<any> = new Subject() | ||||
|   docChangeNotifier: Subject<any> = new Subject() | ||||
|  | ||||
|   requiresPassword: boolean = false | ||||
|   password: string | ||||
| @@ -117,18 +118,7 @@ export class DocumentDetailComponent | ||||
|     private toastService: ToastService, | ||||
|     private settings: SettingsService, | ||||
|     private queryParamsService: QueryParamsService | ||||
|   ) { | ||||
|     this.titleSubject | ||||
|       .pipe( | ||||
|         debounceTime(1000), | ||||
|         distinctUntilChanged(), | ||||
|         takeUntil(this.unsubscribeNotifier) | ||||
|       ) | ||||
|       .subscribe((titleValue) => { | ||||
|         this.title = titleValue | ||||
|         this.documentForm.patchValue({ title: titleValue }) | ||||
|       }) | ||||
|   } | ||||
|   ) {} | ||||
|  | ||||
|   titleKeyUp(event) { | ||||
|     this.titleSubject.next(event.target?.value) | ||||
| @@ -184,6 +174,7 @@ export class DocumentDetailComponent | ||||
|       .pipe( | ||||
|         switchMap((paramMap) => { | ||||
|           const documentId = +paramMap.get('id') | ||||
|           this.docChangeNotifier.next(documentId) | ||||
|           return this.documentsService.get(documentId) | ||||
|         }) | ||||
|       ) | ||||
| @@ -208,6 +199,18 @@ export class DocumentDetailComponent | ||||
|             this.updateComponent(doc) | ||||
|           } | ||||
|  | ||||
|           this.titleSubject | ||||
|             .pipe( | ||||
|               debounceTime(1000), | ||||
|               distinctUntilChanged(), | ||||
|               takeUntil(this.docChangeNotifier), | ||||
|               takeUntil(this.unsubscribeNotifier) | ||||
|             ) | ||||
|             .subscribe((titleValue) => { | ||||
|               this.title = titleValue | ||||
|               this.documentForm.patchValue({ title: titleValue }) | ||||
|             }) | ||||
|  | ||||
|           this.ogDate = new Date(normalizeDateStr(doc.created.toString())) | ||||
|  | ||||
|           // Initialize dirtyCheck | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon