diff options
author | Saturnino Abril <saturnino.abril@gmail.com> | 2017-05-08 21:54:42 +0900 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2017-05-08 13:54:42 +0100 |
commit | 431d89f5f6a333bad7811ba8c3aae5736d0b32db (patch) | |
tree | 675886cd7826485eda909679c328b959a2002d49 | |
parent | 14b9d7784ee832603342f25b5eddb538a8676d74 (diff) | |
download | chat-431d89f5f6a333bad7811ba8c3aae5736d0b32db.tar.gz chat-431d89f5f6a333bad7811ba8c3aae5736d0b32db.tar.bz2 chat-431d89f5f6a333bad7811ba8c3aae5736d0b32db.zip |
fix JS error when deleting RHS root (#6344)
-rw-r--r-- | webapp/components/rhs_thread.jsx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/webapp/components/rhs_thread.jsx b/webapp/components/rhs_thread.jsx index da958d9d5..174799878 100644 --- a/webapp/components/rhs_thread.jsx +++ b/webapp/components/rhs_thread.jsx @@ -321,18 +321,16 @@ export default class RhsThread extends React.Component { } render() { - const postsArray = this.state.postsArray; - const selected = this.state.selected; - const profiles = this.state.profiles || {}; - const rootPostDay = Utils.getDateForUnixTicks(selected.create_at); - let previousPostDay = rootPostDay; - - if (postsArray == null || selected == null) { + if (this.state.postsArray == null || this.state.selected == null) { return ( <div/> ); } + const postsArray = this.state.postsArray; + const selected = this.state.selected; + const profiles = this.state.profiles || {}; + let profile; if (UserStore.getCurrentId() === selected.user_id) { profile = this.props.currentUser; @@ -350,6 +348,9 @@ export default class RhsThread extends React.Component { rootStatus = this.state.statuses[selected.user_id] || 'offline'; } + const rootPostDay = Utils.getDateForUnixTicks(selected.create_at); + let previousPostDay = rootPostDay; + const commentsLists = []; for (let i = 0; i < postsArray.length; i++) { const comPost = postsArray[i]; |