summaryrefslogtreecommitdiffstats
path: root/ui/src/components/post-form.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2019-12-14 16:15:28 -0800
committerDessalines <tyhou13@gmx.com>2019-12-14 16:15:28 -0800
commitf2b2f99a51cab4cdf52711e5195892440bd019af (patch)
treec3e1e9e453becfb787fb468ec06cbd887cd855a8 /ui/src/components/post-form.tsx
parente4cea91ea84c0f0ab04e817fa4ad7a9a13eecf7e (diff)
Fix post title and url change.
- Fixes #368
Diffstat (limited to 'ui/src/components/post-form.tsx')
-rw-r--r--ui/src/components/post-form.tsx7
1 files changed, 4 insertions, 3 deletions
diff --git a/ui/src/components/post-form.tsx b/ui/src/components/post-form.tsx
index fd51c38f..9bfa7063 100644
--- a/ui/src/components/post-form.tsx
+++ b/ui/src/components/post-form.tsx
@@ -20,12 +20,12 @@ import { WebSocketService, UserService } from '../services';
import {
msgOp,
getPageTitle,
- debounce,
validURL,
capitalizeFirstLetter,
markdownHelpUrl,
archiveUrl,
mdToHtml,
+ debounce,
} from '../utils';
import * as autosize from 'autosize';
import { i18n } from '../i18next';
@@ -79,6 +79,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
if (this.props.post) {
this.state.postForm = {
body: this.props.post.body,
+ // NOTE: debouncing breaks both these for some reason, unless you use defaultValue
name: this.props.post.name,
community_id: this.props.post.community_id,
edit_id: this.props.post.id,
@@ -142,7 +143,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
<input
type="url"
class="form-control"
- value={this.state.postForm.url}
+ defaultValue={this.state.postForm.url}
onInput={linkEvent(this, this.handlePostUrlChange)}
/>
{this.state.suggestedTitle && (
@@ -208,7 +209,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
</label>
<div class="col-sm-10">
<textarea
- value={this.state.postForm.name}
+ defaultValue={this.state.postForm.name}
onInput={linkEvent(this, this.handlePostNameChange)}
class="form-control"
required