PLT-7128: Added an undefined check around the scrollIntoView() command to avoid trying to scroll to something that has gone out of scope (#6998)

Этот коммит содержится в:
Jonathan
2017-07-27 08:17:47 -04:00
коммит произвёл Joram Wilander
родитель cc3a95fdd9
Коммит 27ff8bb146

Просмотреть файл

@@ -397,8 +397,11 @@ export default class CreateComment extends React.Component {
draft.fileInfos = draft.fileInfos.concat(fileInfos);
PostStore.storeCommentDraft(this.props.rootId, draft);
// Focus on preview if needed
this.refs.preview.refs.container.scrollIntoView();
// Focus on preview if needed/possible - if user has switched teams since starting the file upload,
// the preview will be undefined and the switch will fail
if (typeof this.refs.preview != 'undefined' && this.refs.preview) {
this.refs.preview.refs.container.scrollIntoView();
}
const enableAddButton = this.handleEnableAddButton(draft.message, draft.fileInfos);