From d68205ce70da40f3330b736374e1f418fb91e086 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 11 Dec 2019 16:25:32 -0800 Subject: [PATCH] Adding debounce for post name and url change - Fixes #367 --- ui/src/components/post-form.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/src/components/post-form.tsx b/ui/src/components/post-form.tsx index 12fb42c..fd51c38 100644 --- a/ui/src/components/post-form.tsx +++ b/ui/src/components/post-form.tsx @@ -343,7 +343,7 @@ export class PostForm extends Component { i.setState(i.state); } - handlePostUrlChange(i: PostForm, event: any) { + handlePostUrlChange = debounce((i: PostForm, event: any) => { i.state.postForm.url = event.target.value; if (validURL(i.state.postForm.url)) { let form: SearchForm = { @@ -367,9 +367,9 @@ export class PostForm extends Component { } i.setState(i.state); - } + }); - handlePostNameChange(i: PostForm, event: any) { + handlePostNameChange = debounce((i: PostForm, event: any) => { i.state.postForm.name = event.target.value; let form: SearchForm = { q: i.state.postForm.name, @@ -387,7 +387,7 @@ export class PostForm extends Component { } i.setState(i.state); - } + }); handlePostBodyChange(i: PostForm, event: any) { i.state.postForm.body = event.target.value;