From: Dessalines Date: Thu, 12 Dec 2019 00:25:32 +0000 (-0800) Subject: Adding debounce for post name and url change X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/save/%22%7B%7D/static/git-logo.png?a=commitdiff_plain;h=4cbfe6d0fc49fcaeaf95d1993ebe6b16fa49b1a3;p=lemmy.git Adding debounce for post name and url change - Fixes #367 --- 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 { 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;