@@ -14,7 +14,6 @@ import {
1414 as ,
1515 config ,
1616} from 'folds' ;
17-
1817import {
1918 MouseEventHandler ,
2019 MouseEvent ,
@@ -35,6 +34,7 @@ import {
3534 Room ,
3635 Relations ,
3736 RoomPinnedEventsEventContent ,
37+ MatrixEventEvent ,
3838} from '$types/matrix-sdk' ;
3939import classNames from 'classnames' ;
4040import { useAtomValue , useSetAtom } from 'jotai' ;
@@ -380,13 +380,15 @@ function MessageInternal(
380380 const mx = useMatrixClient ( ) ;
381381 const useAuthentication = useMediaAuthentication ( ) ;
382382
383- const [ editVersion , setEditVersion ] = useState ( 0 ) ;
383+ const [ contentVersion , setContentVersion ] = useState ( 0 ) ;
384384
385385 useEffect ( ( ) => {
386- const onReplaced = ( ) => setEditVersion ( ( v ) => v + 1 ) ;
387- mEvent . on ( 'Event.replaced' as any , onReplaced ) ;
386+ const onUpdate = ( ) => setContentVersion ( ( v ) => v + 1 ) ;
387+ mEvent . on ( MatrixEventEvent . Decrypted , onUpdate ) ;
388+ mEvent . on ( MatrixEventEvent . Replaced , onUpdate ) ;
388389 return ( ) => {
389- mEvent . off ( 'Event.replaced' as any , onReplaced ) ;
390+ mEvent . off ( MatrixEventEvent . Decrypted , onUpdate ) ;
391+ mEvent . off ( MatrixEventEvent . Replaced , onUpdate ) ;
390392 } ;
391393 } , [ mEvent ] ) ;
392394
@@ -411,7 +413,7 @@ function MessageInternal(
411413 | PerMessageProfileBeeperFormat
412414 | undefined ;
413415 // eslint-disable-next-line react-hooks/exhaustive-deps
414- } , [ mEvent , room , editVersion ] ) ;
416+ } , [ mEvent , room , contentVersion ] ) ;
415417
416418 /**
417419 * We convert the per-message profile from the Beeper format to our internal format here in the message component
0 commit comments