add debounce for search, increase the timer for fulltext updates (#5844)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov
2024-06-18 12:34:02 +07:00
committed by GitHub
parent c526365e4d
commit ece0504d3c
2 changed files with 80 additions and 72 deletions
@@ -295,6 +295,15 @@
$: void translate(view.string.ActionPlaceholder, {}).then((res) => {
phTraslate = res
})
let timer: any
$: _search = search
function restartTimer (): void {
clearTimeout(timer)
timer = setTimeout(() => {
search = _search
dispatch('change', _search)
}, 500)
}
</script>
<ActionContext
@@ -364,10 +373,14 @@
class="actionsInput"
bind:this={textHTML}
type="text"
bind:value={search}
bind:value={_search}
placeholder={phTraslate}
on:change
on:input
on:change={() => {
restartTimer()
}}
on:input={() => {
restartTimer()
}}
on:keydown
/>
</div>