From f27afc6ff896a36260b00544f23249e609967830 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 22 Jul 2020 12:43:10 -0600 Subject: [PATCH] Fix message previews not updating on their own --- src/stores/room-list/MessagePreviewStore.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/stores/room-list/MessagePreviewStore.ts b/src/stores/room-list/MessagePreviewStore.ts index 4a308f67b5..f61488c3bb 100644 --- a/src/stores/room-list/MessagePreviewStore.ts +++ b/src/stores/room-list/MessagePreviewStore.ts @@ -144,13 +144,14 @@ export class MessagePreviewStore extends AsyncStoreWithClient { 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()); this.emit(UPDATE_EVENT, this); } @@ -159,7 +160,7 @@ export class MessagePreviewStore extends AsyncStoreWithClient { 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); } }