Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-encrypted-pmp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

Fix recieved encrypted message per-message profiles not triggering rerenders.
14 changes: 8 additions & 6 deletions src/app/features/room/message/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
as,
config,
} from 'folds';

import {
MouseEventHandler,
MouseEvent,
Expand All @@ -35,6 +34,7 @@ import {
Room,
Relations,
RoomPinnedEventsEventContent,
MatrixEventEvent,
} from '$types/matrix-sdk';
import classNames from 'classnames';
import { useAtomValue, useSetAtom } from 'jotai';
Expand Down Expand Up @@ -380,13 +380,15 @@ function MessageInternal(
const mx = useMatrixClient();
const useAuthentication = useMediaAuthentication();

const [editVersion, setEditVersion] = useState(0);
const [contentVersion, setContentVersion] = useState(0);

useEffect(() => {
const onReplaced = () => setEditVersion((v) => v + 1);
mEvent.on('Event.replaced' as any, onReplaced);
const onUpdate = () => setContentVersion((v) => v + 1);
mEvent.on(MatrixEventEvent.Decrypted, onUpdate);
mEvent.on(MatrixEventEvent.Replaced, onUpdate);
return () => {
mEvent.off('Event.replaced' as any, onReplaced);
mEvent.off(MatrixEventEvent.Decrypted, onUpdate);
mEvent.off(MatrixEventEvent.Replaced, onUpdate);
};
}, [mEvent]);

Expand All @@ -411,7 +413,7 @@ function MessageInternal(
| PerMessageProfileBeeperFormat
| undefined;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [mEvent, room, editVersion]);
}, [mEvent, room, contentVersion]);

/**
* We convert the per-message profile from the Beeper format to our internal format here in the message component
Expand Down
Loading