mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 02:05:45 +03:00
Fix message previews not updating on their own
This commit is contained in:
parent
0ef6696c0a
commit
f27afc6ff8
1 changed files with 3 additions and 2 deletions
|
@ -144,13 +144,14 @@ export class MessagePreviewStore extends AsyncStoreWithClient<IState> {
|
|||
|
||||
if (changed) {
|
||||
// We've muted the underlying Map, so just emit that we've changed.
|
||||
this.previews.set(room.roomId, map);
|
||||
this.emit(UPDATE_EVENT, this);
|
||||
}
|
||||
return; // we're done
|
||||
}
|
||||
|
||||
// At this point, we didn't generate a preview so clear it
|
||||
this.previews.delete(room.roomId);
|
||||
this.previews.set(room.roomId, new Map<TagID|TAG_ANY, string|null>());
|
||||
this.emit(UPDATE_EVENT, this);
|
||||
}
|
||||
|
||||
|
@ -159,7 +160,7 @@ export class MessagePreviewStore extends AsyncStoreWithClient<IState> {
|
|||
|
||||
if (payload.action === 'MatrixActions.Room.timeline' || payload.action === 'MatrixActions.Event.decrypted') {
|
||||
const event = payload.event; // TODO: Type out the dispatcher
|
||||
if (!Object.keys(this.state).includes(event.getRoomId())) return; // not important
|
||||
if (!this.previews.has(event.getRoomId())) return; // not important
|
||||
this.generatePreview(this.matrixClient.getRoom(event.getRoomId()), TAG_ANY);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue