Merge pull request #401 from paperless-ngx/fix-issue-288

Add minimum length for documents text filter
This commit is contained in:
shamoon 2022-03-17 03:22:19 -07:00 committed by GitHub
commit 24e02a6c5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,7 @@ import { PaperlessTag } from 'src/app/data/paperless-tag'
import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'
import { PaperlessDocumentType } from 'src/app/data/paperless-document-type'
import { Subject, Subscription } from 'rxjs'
import { debounceTime, distinctUntilChanged } from 'rxjs/operators'
import { debounceTime, distinctUntilChanged, filter } from 'rxjs/operators'
import { DocumentTypeService } from 'src/app/services/rest/document-type.service'
import { TagService } from 'src/app/services/rest/tag.service'
import { CorrespondentService } from 'src/app/services/rest/correspondent.service'
@ -422,7 +422,11 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
this.textFilterDebounce = new Subject<string>()
this.subscription = this.textFilterDebounce
.pipe(debounceTime(400), distinctUntilChanged())
.pipe(
debounceTime(400),
distinctUntilChanged(),
filter((query) => !query.length || query.length > 2)
)
.subscribe((text) => {
this._textFilter = text
this.documentService.searchQuery = text