diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-06-07 17:15:18 +0200 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-11-19 16:48:43 -0600 |
commit | 160ed28c30f238ba662d8aff35d1827301bfee69 (patch) | |
tree | eb698e52e12a7c8a35a2e225462322c21a69021e /app | |
parent | a64b016195b3388c61ecf241fefeb396c63eb0c1 (diff) |
Fix some React warnings (#10989)
Diffstat (limited to 'app')
-rw-r--r-- | app/javascript/mastodon/components/autosuggest_textarea.js | 5 | ||||
-rw-r--r-- | app/javascript/mastodon/features/compose/components/compose_form.js | 12 |
2 files changed, 10 insertions, 7 deletions
diff --git a/app/javascript/mastodon/components/autosuggest_textarea.js b/app/javascript/mastodon/components/autosuggest_textarea.js index 4c50294ba..b070fe3e5 100644 --- a/app/javascript/mastodon/components/autosuggest_textarea.js +++ b/app/javascript/mastodon/components/autosuggest_textarea.js @@ -201,7 +201,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { } return [ - <div className='compose-form__autosuggest-wrapper'> + <div className='compose-form__autosuggest-wrapper' key='autosuggest-wrapper'> <div className='autosuggest-textarea'> <label> <span style={{ display: 'none' }}>{placeholder}</span> @@ -226,7 +226,8 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { </div> {children} </div>, - <div className='autosuggest-textarea__suggestions-wrapper'> + + <div className='autosuggest-textarea__suggestions-wrapper' key='suggestions-wrapper'> <div className={`autosuggest-textarea__suggestions ${suggestionsHidden || suggestions.isEmpty() ? '' : 'autosuggest-textarea__suggestions--visible'}`}> {suggestions.map(this.renderSuggestion)} </div> diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js index ff22a2953..f965e6c75 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/mastodon/features/compose/components/compose_form.js @@ -34,10 +34,6 @@ const messages = defineMessages({ export default @injectIntl class ComposeForm extends ImmutablePureComponent { - setRef = c => { - this.composeForm = c; - }; - static contextTypes = { router: PropTypes.object, }; @@ -120,7 +116,9 @@ class ComposeForm extends ImmutablePureComponent { } handleFocus = () => { - this.composeForm.scrollIntoView(); + if (this.composeForm) { + this.composeForm.scrollIntoView(); + } } componentDidUpdate (prevProps) { @@ -164,6 +162,10 @@ class ComposeForm extends ImmutablePureComponent { this.spoilerText = c; } + setRef = c => { + this.composeForm = c; + }; + handleEmojiPick = (data) => { const { text } = this.props; const position = this.autosuggestTextarea.textarea.selectionStart; |