Removing debounce.

This commit is contained in:
Dessalines 2019-12-28 19:06:19 -05:00
parent 38d6db6d81
commit f060ffadcc

View file

@ -143,7 +143,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
<input <input
type="url" type="url"
class="form-control" class="form-control"
defaultValue={this.state.postForm.url} value={this.state.postForm.url}
onInput={linkEvent(this, this.handlePostUrlChange)} onInput={linkEvent(this, this.handlePostUrlChange)}
/> />
{this.state.suggestedTitle && ( {this.state.suggestedTitle && (
@ -209,10 +209,6 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
</label> </label>
<div class="col-sm-10"> <div class="col-sm-10">
<textarea <textarea
defaultValue={
this.props.post ? this.props.post.name : undefined
}
/* This needs to be undefined for some weird reason */
value={this.state.postForm.name} value={this.state.postForm.name}
onInput={linkEvent(this, this.handlePostNameChange)} onInput={linkEvent(this, this.handlePostNameChange)}
class="form-control" class="form-control"
@ -348,7 +344,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
i.setState(i.state); i.setState(i.state);
} }
handlePostUrlChange = debounce((i: PostForm, event: any) => { handlePostUrlChange(i: PostForm, event: any) {
i.state.postForm.url = event.target.value; i.state.postForm.url = event.target.value;
if (validURL(i.state.postForm.url)) { if (validURL(i.state.postForm.url)) {
let form: SearchForm = { let form: SearchForm = {
@ -372,9 +368,9 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
} }
i.setState(i.state); i.setState(i.state);
}); }
handlePostNameChange = debounce((i: PostForm, event: any) => { handlePostNameChange(i: PostForm, event: any) {
i.state.postForm.name = event.target.value; i.state.postForm.name = event.target.value;
let form: SearchForm = { let form: SearchForm = {
q: i.state.postForm.name, q: i.state.postForm.name,
@ -392,7 +388,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
} }
i.setState(i.state); i.setState(i.state);
}); }
handlePostBodyChange(i: PostForm, event: any) { handlePostBodyChange(i: PostForm, event: any) {
i.state.postForm.body = event.target.value; i.state.postForm.body = event.target.value;