Adding debounce for post name and url change

- Fixes #367
This commit is contained in:
Dessalines 2019-12-11 16:25:32 -08:00
parent fca8e6a0a9
commit 4cbfe6d0fc

View file

@ -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;