From 1149b13502563d30701e76fb8c84bb8ad6f94683 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 8 Apr 2024 15:07:28 +0100 Subject: [PATCH] Fix space hierarchy tile busy state being stuck after join error (#12405) Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/SpaceHierarchy.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/structures/SpaceHierarchy.tsx b/src/components/structures/SpaceHierarchy.tsx index dfd8ff5fce4..aa3cf3612dd 100644 --- a/src/components/structures/SpaceHierarchy.tsx +++ b/src/components/structures/SpaceHierarchy.tsx @@ -136,11 +136,12 @@ const Tile: React.FC = ({ setBusy(true); ev.preventDefault(); ev.stopPropagation(); - onJoinRoomClick() - .then(() => awaitRoomDownSync(cli, room.room_id)) - .finally(() => { - setBusy(false); - }); + try { + await onJoinRoomClick(); + await awaitRoomDownSync(cli, room.room_id); + } finally { + setBusy(false); + } }; let button: ReactElement; @@ -418,7 +419,8 @@ export const joinRoom = async (cli: MatrixClient, hierarchy: RoomHierarchy, room ); } - return; + // rethrow error so that the caller can handle react to it too + throw err; } defaultDispatcher.dispatch({