mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
avoid null-refs when receiving an action before initial rendering
This commit is contained in:
parent
6df46cc319
commit
9f72268df7
1 changed files with 3 additions and 3 deletions
|
@ -240,7 +240,7 @@ export default class SendMessageComposer extends React.Component {
|
||||||
switch (payload.action) {
|
switch (payload.action) {
|
||||||
case 'reply_to_event':
|
case 'reply_to_event':
|
||||||
case 'focus_composer':
|
case 'focus_composer':
|
||||||
this._editorRef.focus();
|
this._editorRef && this._editorRef.focus();
|
||||||
break;
|
break;
|
||||||
case 'insert_mention':
|
case 'insert_mention':
|
||||||
this._insertMention(payload.user_id);
|
this._insertMention(payload.user_id);
|
||||||
|
@ -258,7 +258,7 @@ export default class SendMessageComposer extends React.Component {
|
||||||
const userPillPart = this.model.partCreator.userPill(displayName, userId);
|
const userPillPart = this.model.partCreator.userPill(displayName, userId);
|
||||||
this.model.insertPartsAt([userPillPart], this._editorRef.getCaret());
|
this.model.insertPartsAt([userPillPart], this._editorRef.getCaret());
|
||||||
// refocus on composer, as we just clicked "Mention"
|
// refocus on composer, as we just clicked "Mention"
|
||||||
this._editorRef.focus();
|
this._editorRef && this._editorRef.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
_insertQuotedMessage(event) {
|
_insertQuotedMessage(event) {
|
||||||
|
@ -269,7 +269,7 @@ export default class SendMessageComposer extends React.Component {
|
||||||
quoteParts.push(partCreator.newline());
|
quoteParts.push(partCreator.newline());
|
||||||
this.model.insertPartsAt(quoteParts, {offset: 0});
|
this.model.insertPartsAt(quoteParts, {offset: 0});
|
||||||
// refocus on composer, as we just clicked "Quote"
|
// refocus on composer, as we just clicked "Quote"
|
||||||
this._editorRef.focus();
|
this._editorRef && this._editorRef.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
Loading…
Reference in a new issue