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> |   store: BehaviorSubject<any> | ||||||
|   isDirty$: Observable<boolean> |   isDirty$: Observable<boolean> | ||||||
|   unsubscribeNotifier: Subject<any> = new Subject() |   unsubscribeNotifier: Subject<any> = new Subject() | ||||||
|  |   docChangeNotifier: Subject<any> = new Subject() | ||||||
|  |  | ||||||
|   requiresPassword: boolean = false |   requiresPassword: boolean = false | ||||||
|   password: string |   password: string | ||||||
| @@ -117,18 +118,7 @@ export class DocumentDetailComponent | |||||||
|     private toastService: ToastService, |     private toastService: ToastService, | ||||||
|     private settings: SettingsService, |     private settings: SettingsService, | ||||||
|     private queryParamsService: QueryParamsService |     private queryParamsService: QueryParamsService | ||||||
|   ) { |   ) {} | ||||||
|     this.titleSubject |  | ||||||
|       .pipe( |  | ||||||
|         debounceTime(1000), |  | ||||||
|         distinctUntilChanged(), |  | ||||||
|         takeUntil(this.unsubscribeNotifier) |  | ||||||
|       ) |  | ||||||
|       .subscribe((titleValue) => { |  | ||||||
|         this.title = titleValue |  | ||||||
|         this.documentForm.patchValue({ title: titleValue }) |  | ||||||
|       }) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   titleKeyUp(event) { |   titleKeyUp(event) { | ||||||
|     this.titleSubject.next(event.target?.value) |     this.titleSubject.next(event.target?.value) | ||||||
| @@ -184,6 +174,7 @@ export class DocumentDetailComponent | |||||||
|       .pipe( |       .pipe( | ||||||
|         switchMap((paramMap) => { |         switchMap((paramMap) => { | ||||||
|           const documentId = +paramMap.get('id') |           const documentId = +paramMap.get('id') | ||||||
|  |           this.docChangeNotifier.next(documentId) | ||||||
|           return this.documentsService.get(documentId) |           return this.documentsService.get(documentId) | ||||||
|         }) |         }) | ||||||
|       ) |       ) | ||||||
| @@ -208,6 +199,18 @@ export class DocumentDetailComponent | |||||||
|             this.updateComponent(doc) |             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())) |           this.ogDate = new Date(normalizeDateStr(doc.created.toString())) | ||||||
|  |  | ||||||
|           // Initialize dirtyCheck |           // Initialize dirtyCheck | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon