diff --git a/src/components/views/right_panel/PinnedMessagesCard.tsx b/src/components/views/right_panel/PinnedMessagesCard.tsx index 1cd7ff0c4a..5c43d5e225 100644 --- a/src/components/views/right_panel/PinnedMessagesCard.tsx +++ b/src/components/views/right_panel/PinnedMessagesCard.tsx @@ -103,10 +103,11 @@ const PinnedMessagesCard: React.FC = ({ room, onClose, permalinkCreator const readPinnedEvents = useReadPinnedEvents(room); useEffect(() => { + if (!cli || cli.isGuest()) return; // nothing to do const newlyRead = pinnedEventIds.filter((id) => !readPinnedEvents.has(id)); if (newlyRead.length > 0) { // clear out any read pinned events which no longer are pinned - cli?.setRoomAccountData(room.roomId, ReadPinsEventId, { + cli.setRoomAccountData(room.roomId, ReadPinsEventId, { event_ids: pinnedEventIds, }); }