mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-25 09:22:22 +00:00
Debounce tag input autocomplete
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
b47e46cef5
commit
85f8450a85
1 changed files with 8 additions and 1 deletions
|
@ -21,7 +21,7 @@
|
|||
maxlength="20"
|
||||
maxtags="10"
|
||||
:placeholder="$t('Eg: Stockholm, Dance, Chess…')"
|
||||
@typing="getFilteredTags"
|
||||
@typing="debouncedGetFilteredTags"
|
||||
:id="id"
|
||||
dir="auto"
|
||||
>
|
||||
|
@ -33,6 +33,7 @@ import { Component, Prop, Vue } from "vue-property-decorator";
|
|||
import differenceBy from "lodash/differenceBy";
|
||||
import { ITag } from "../../types/tag.model";
|
||||
import { FILTER_TAGS } from "@/graphql/tags";
|
||||
import debounce from "lodash/debounce";
|
||||
|
||||
@Component({
|
||||
apollo: {
|
||||
|
@ -63,6 +64,12 @@ export default class TagInput extends Vue {
|
|||
return `tag-input-${TagInput.componentId}`;
|
||||
}
|
||||
|
||||
data(): Record<string, unknown> {
|
||||
return {
|
||||
debouncedGetFilteredTags: debounce(this.getFilteredTags, 200),
|
||||
};
|
||||
}
|
||||
|
||||
async getFilteredTags(text: string): Promise<void> {
|
||||
this.text = text;
|
||||
await this.$apollo.queries.tags.refetch();
|
||||
|
|
Loading…
Reference in a new issue