fix: only populate filters with additional data from api if there is none yet

This commit is contained in:
kolaente 2022-08-15 22:47:19 +02:00
parent 51ffe93048
commit 478e62eaed
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 9 additions and 0 deletions

View File

@ -500,6 +500,14 @@ export default defineComponent({
return
}
// Don't load things if we already have something loaded.
// This is not the most ideal solution because it prevents a re-population when filters are changed
// from the outside. It is still fine because we're not changing them from the outside, other than
// loading them initially.
if(this[kind].length > 0) {
return
}
this[kind] = await this[`${servicePrefix}Service`].getAll({}, {s: this.filters[filterName]})
},
setDoneFilter() {
@ -532,6 +540,7 @@ export default defineComponent({
if (query === '') {
this.clear(kind)
return
}
const response = await this[`${kind}Service`].getAll({}, {s: query})