Prevent infinite loop

This commit is contained in:
Half-Shot 2024-10-29 15:19:16 +00:00
parent 528e692d6b
commit cd73ad8794
2 changed files with 7 additions and 7 deletions

View File

@ -53,13 +53,11 @@ const InnerButton: FC<InnerButtonButtonProps> = ({ raised, ...props }) => {
};
interface RaisedHandToggleButton {
key: string;
rtcSession: MatrixRTCSession;
client: MatrixClient;
}
export function RaiseHandToggleButton({
key,
client,
rtcSession,
}: RaisedHandToggleButton): ReactNode {
@ -135,7 +133,6 @@ export function RaiseHandToggleButton({
return (
<InnerButton
key={key}
disabled={busy}
onClick={toggleRaisedHand}
raised={isHandRaised}

View File

@ -114,7 +114,10 @@ export const ReactionsProvider = ({
if (!m.sender || !m.eventId) {
continue;
}
if (raisedHands[m.sender].parentEventId !== m.eventId) {
if (
raisedHands[m.sender] &&
raisedHands[m.sender].parentEventId !== m.eventId
) {
// Membership event for sender has changed.
removeRaisedHand(m.sender);
}
@ -133,9 +136,9 @@ export const ReactionsProvider = ({
}
}
}
// Deliberately ignoring addRaisedHand which was causing looping.
// Deliberately ignoring addRaisedHand, raisedHands which was causing looping.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [raisedHands, room, memberships]);
}, [room, memberships]);
useEffect(() => {
const handleReactionEvent = (event: MatrixEvent): void => {
@ -174,7 +177,7 @@ export const ReactionsProvider = ({
Object.fromEntries(
Object.entries(raisedHands).map(([uid, data]) => [uid, data.time]),
),
[raisedHands],
[raisedHands, raisedHandCount],
);
return (