diff options
author | Dessalines <tyhou13@gmx.com> | 2019-12-11 16:25:32 -0800 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2019-12-11 16:25:32 -0800 |
commit | 4cbfe6d0fc49fcaeaf95d1993ebe6b16fa49b1a3 (patch) | |
tree | c21039af5ca8b579854774b52b4bc353f7c47ad0 /ui/src/components/post-form.tsx | |
parent | fca8e6a0a9308340e88ad291c89c40e7d17f27be (diff) |
Adding debounce for post name and url change
- Fixes #367
Diffstat (limited to 'ui/src/components/post-form.tsx')
-rw-r--r-- | ui/src/components/post-form.tsx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ui/src/components/post-form.tsx b/ui/src/components/post-form.tsx index 12fb42c5..fd51c38f 100644 --- a/ui/src/components/post-form.tsx +++ b/ui/src/components/post-form.tsx @@ -343,7 +343,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> { 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<PostFormProps, PostFormState> { } 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<PostFormProps, PostFormState> { } i.setState(i.state); - } + }); handlePostBodyChange(i: PostForm, event: any) { i.state.postForm.body = event.target.value; |