Skip to content

Commit afa2436

Browse files
Added Debouncing to search in Forms, Users, and APIs tables
1 parent 28a1b87 commit afa2436

3 files changed

Lines changed: 25 additions & 8 deletions

File tree

app/frontend/src/components/admin/AdminAPIsTable.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,17 @@ async function updateOptions(options) {
176176
firstDataLoad.value = false;
177177
}
178178
179-
async function handleSearch(value) {
179+
const debouncedSearch = _.debounce(async (value) => {
180180
search.value = value;
181+
await getApis();
182+
}, debounceTime.value);
183+
184+
async function handleSearch(value) {
181185
if (value === '') {
186+
search.value = value;
182187
await getApis();
183188
} else {
184-
debounceInput.value();
189+
debouncedSearch(value);
185190
}
186191
}
187192
</script>

app/frontend/src/components/admin/AdminFormsTable.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ const { t, locale } = useI18n({ useScope: 'global' });
1111
1212
const showDeleted = ref(false);
1313
const loading = ref(false);
14+
const inputValue = ref('');
1415
const search = ref('');
1516
const firstDataLoad = ref(true);
1617
const forceTableRefresh = ref(0);
1718
const debounceInput = ref(null);
18-
const debounceTime = ref(300);
19+
const debounceTime = ref(500);
1920
const currentPage = ref(1);
2021
const itemsPP = ref(10);
2122
@@ -90,12 +91,18 @@ async function updateOptions(options) {
9091
}
9192
firstDataLoad.value = false;
9293
}
93-
async function handleSearch(value) {
94+
95+
const debouncedSearch = _.debounce(async (value) => {
9496
search.value = value;
97+
await refreshForms();
98+
}, debounceTime.value);
99+
100+
async function handleSearch(value) {
95101
if (value === '') {
102+
search.value = value;
96103
await refreshForms();
97104
} else {
98-
debounceInput.value();
105+
debouncedSearch(value);
99106
}
100107
}
101108
</script>
@@ -126,7 +133,7 @@ async function handleSearch(value) {
126133
:class="isRTL ? 'float-left' : 'float-right'"
127134
>
128135
<v-text-field
129-
v-model="search"
136+
v-model="inputValue"
130137
density="compact"
131138
variant="underlined"
132139
:lang="locale"

app/frontend/src/components/admin/AdminUsersTable.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,17 @@ async function updateOptions(options) {
7575
firstDataLoad.value = false;
7676
}
7777
78-
async function handleSearch(value) {
78+
const debouncedSearch = _.debounce(async (value) => {
7979
search.value = value;
80+
await refreshUsers();
81+
}, debounceTime.value);
82+
83+
async function handleSearch(value) {
8084
if (value === '') {
85+
search.value = value;
8186
await refreshUsers();
8287
} else {
83-
debounceInput.value();
88+
debouncedSearch(value);
8489
}
8590
}
8691

0 commit comments

Comments
 (0)