Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 1b4c3f6

Browse files
committed
Handle state updates
1 parent d027452 commit 1b4c3f6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/views/messages/RoomCreate.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { MatrixClientPeg } from "../../../MatrixClientPeg";
2727
import EventTileBubble from "./EventTileBubble";
2828
import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload";
2929
import RoomContext from "../../../contexts/RoomContext";
30+
import { useRoomState } from "../../../hooks/useRoomState";
3031

3132
interface IProps {
3233
/** The m.room.create MatrixEvent that this tile represents */
@@ -44,7 +45,10 @@ export const RoomCreate: React.FC<IProps> = ({ mxEvent, timestamp }) => {
4445
// use a different predecessor (e.g. through MSC3946) and still display it
4546
// in the timeline location of the create event.
4647
const roomContext = useContext(RoomContext);
47-
const predecessor = roomContext.room.findPredecessor();
48+
const predecessor = useRoomState(
49+
roomContext.room,
50+
useCallback((state) => state.findPredecessor(), []),
51+
);
4852

4953
const onLinkClicked = useCallback(
5054
(e: React.MouseEvent): void => {

0 commit comments

Comments
 (0)