Skip to content

Commit 7a80968

Browse files
committed
Update FindMatchContext to set finding match status
1 parent fc3bee5 commit 7a80968

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

frontend/src/contexts/FindMatchContext.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,10 @@ export function FindMatchProvider({
103103
socket.connect();
104104
socket.once("connected", () => {
105105
socket.emit("findMatch", matchRequest);
106+
socket.once("matchRequested", () => {
107+
setFindingMatch(true);
108+
});
106109
});
107-
setFindingMatch(true);
108110
}, [socket, matchRequest]);
109111

110112
const handleCancelMatch = useCallback(() => {
@@ -204,8 +206,9 @@ export function FindMatchProvider({
204206
title: "Error",
205207
description: error,
206208
});
209+
socket.disconnect();
207210
},
208-
[toast]
211+
[socket, toast]
209212
);
210213

211214
useEffect(() => {

0 commit comments

Comments
 (0)