about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/compose
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-06-07 17:15:18 +0200
committermultiple creatures <dev@multiple-creature.party>2020-02-22 01:29:06 -0600
commit27f826b5b12441e2de64015c42f736e865a146b2 (patch)
treeaec25a8adca855f235d513e6c637e9096ec96b93 /app/javascript/flavours/glitch/features/compose
parent92b9c17bf4ee0b29041b9a72b9c3de4705b47494 (diff)
[Glitch] Fix some React warnings
Port cc8f6b3cdaca81be99875c27002e0280d1d88191 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/compose')
-rw-r--r--app/javascript/flavours/glitch/features/compose/components/compose_form.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.js b/app/javascript/flavours/glitch/features/compose/components/compose_form.js
index de89b7266..2ec77f61b 100644
--- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js
+++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js
@@ -31,10 +31,6 @@ const messages = defineMessages({
 export default @injectIntl
 class ComposeForm extends ImmutablePureComponent {
 
-  setRef = c => {
-    this.composeForm = c;
-  };
-
   static contextTypes = {
     router: PropTypes.object,
   };
@@ -151,6 +147,10 @@ class ComposeForm extends ImmutablePureComponent {
     }
   }
 
+  setRef = c => {
+    this.composeForm = c;
+  };
+
   //  Inserts an emoji at the caret.
   handleEmoji = (data) => {
     const { textarea: { selectionStart } } = this;
@@ -223,7 +223,9 @@ class ComposeForm extends ImmutablePureComponent {
   }
 
   handleFocus = () => {
-    this.composeForm.scrollIntoView();
+    if (this.composeForm) {
+      this.composeForm.scrollIntoView();
+    }
   }
 
   //  This statement does several things: