fix(webui): add debouncer when searching for author in Edit Book dialog

Closes: #960
This commit is contained in:
Aiman 2022-10-30 08:59:57 +08:00 committed by GitHub
parent 59e6517488
commit da3d283503
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -412,6 +412,7 @@ import {helpers, requiredIf} from 'vuelidate/lib/validators'
import {BookDto, BookThumbnailDto} from '@/types/komga-books'
import IsbnVerify from '@saekitominaga/isbn-verify'
import {isMatch} from 'date-fns'
import {debounce} from 'lodash'
import {ERROR, ErrorEvent} from '@/types/events'
import DropZone from '@/components/DropZone.vue'
import ThumbnailCard from '@/components/ThumbnailCard.vue'
@ -488,10 +489,10 @@ export default Vue.extend({
},
authorSearch: {
deep: true,
async handler(val: []) {
handler: debounce(async function (this: any, val: []) {
const index = val.findIndex(x => x !== null)
this.authorSearchResults = await this.$komgaReferential.getAuthorsNames(val[index])
},
}, 500),
},
},
validations: {