From 069a8d05f13f6c397db708ba673e251227456879 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 14 Oct 2021 12:06:24 +0100 Subject: [PATCH] Space Room View should react to join rule changes down /sync --- src/components/structures/SpaceRoomView.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/structures/SpaceRoomView.tsx b/src/components/structures/SpaceRoomView.tsx index 629c62cde0..0e71d63134 100644 --- a/src/components/structures/SpaceRoomView.tsx +++ b/src/components/structures/SpaceRoomView.tsx @@ -79,6 +79,7 @@ import { useAsyncMemo } from "../../hooks/useAsyncMemo"; import Spinner from "../views/elements/Spinner"; import GroupAvatar from "../views/avatars/GroupAvatar"; import { useDispatcher } from "../../hooks/useDispatcher"; +import { useRoomState } from "../../hooks/useRoomState"; import { logger } from "matrix-js-sdk/src/logger"; @@ -124,7 +125,7 @@ const useMyRoomMembership = (room: Room) => { }; const SpaceInfo = ({ space }) => { - const joinRule = space.getJoinRule(); + const joinRule = useRoomState(space, state => state.getJoinRule()); let visibilitySection; if (joinRule === "public") { @@ -204,8 +205,9 @@ const SpacePreview = ({ space, onJoinButtonClicked, onRejectButtonClicked }: ISp const spacesEnabled = SpaceStore.spacesEnabled; + const joinRule = useRoomState(space, state => state.getJoinRule()); const cannotJoin = getEffectiveMembership(myMembership) === EffectiveMembership.Leave - && space.getJoinRule() !== JoinRule.Public; + && joinRule !== JoinRule.Public; let inviterSection; let joinButtons;