Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix message load in Thread list (#7124)
Browse files Browse the repository at this point in the history
  • Loading branch information
germain-gg committed Nov 12, 2021
1 parent 77c7946 commit 894ae6a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/views/rooms/EventTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1165,12 +1165,15 @@ export default class EventTile extends React.Component<IProps, IState> {
|| this.state.hover
|| this.state.actionBarFocused);

const room = MatrixClientPeg.get().getRoom(this.props.mxEvent.getRoomId());
const thread = room.findThreadForEvent?.(this.props.mxEvent);

// Thread panel shows the timestamp of the last reply in that thread
const ts = this.props.tileShape !== TileShape.ThreadPanel
? this.props.mxEvent.getTs()
: this.props.mxEvent.getThread().lastReply.getTs();
: thread?.lastReply.getTs();

const timestamp = showTimestamp ?
const timestamp = showTimestamp && ts ?
<MessageTimestamp
showRelative={this.props.tileShape === TileShape.ThreadPanel}
showTwelveHour={this.props.isTwelveHour}
Expand Down

1 comment on commit 894ae6a

@DoM1niC
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appearance crashed with this

EventTile.tsx:1261 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'findThreadForEvent')
    at i.render (EventTile.tsx:1261)
    at qa (react-dom.production.min.js:187)
    at Ga (react-dom.production.min.js:186)
    at qs (react-dom.production.min.js:269)
    at Sc (react-dom.production.min.js:250)
    at yc (react-dom.production.min.js:250)
    at vc (react-dom.production.min.js:250)
    at pc (react-dom.production.min.js:243)
    at react-dom.production.min.js:123
    at t.unstable_runWithPriority (scheduler.production.min.js:18)
render @ EventTile.tsx:1261
qa @ react-dom.production.min.js:187
Ga @ react-dom.production.min.js:186
qs @ react-dom.production.min.js:269
Sc @ react-dom.production.min.js:250
yc @ react-dom.production.min.js:250
vc @ react-dom.production.min.js:250
pc @ react-dom.production.min.js:243
(anonym) @ react-dom.production.min.js:123
t.unstable_runWithPriority @ scheduler.production.min.js:18
jo @ react-dom.production.min.js:122
Yo @ react-dom.production.min.js:123
Ho @ react-dom.production.min.js:122
sc @ react-dom.production.min.js:237
enqueueSetState @ react-dom.production.min.js:133
m.setState @ react.production.min.js:12
componentDidMount @ FontScalingPanel.tsx:73
async function (async)
componentDidMount @ FontScalingPanel.tsx:70
ps @ react-dom.production.min.js:219
wc @ react-dom.production.min.js:259
t.unstable_runWithPriority @ scheduler.production.min.js:18
jo @ react-dom.production.min.js:122
xc @ react-dom.production.min.js:252
pc @ react-dom.production.min.js:243
(anonym) @ react-dom.production.min.js:123
t.unstable_runWithPriority @ scheduler.production.min.js:18
jo @ react-dom.production.min.js:122
Yo @ react-dom.production.min.js:123
Ho @ react-dom.production.min.js:122
Re @ react-dom.production.min.js:292
$t @ react-dom.production.min.js:73

Please sign in to comment.