Skip to content

Commit 9ae828a

Browse files
committed
Fix frontend lint
1 parent 8030c71 commit 9ae828a

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

frontend/src/contexts/MatchContext.tsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ const MatchProvider: React.FC<{ children?: React.ReactNode }> = (props) => {
9898
throw new Error(USE_AUTH_ERROR_MESSAGE);
9999
}
100100
const { user } = auth;
101-
const [matchUser, _setMatchUser] = useState<MatchUser | null>(
101+
console.log(user);
102+
const [matchUser] = useState<MatchUser | null>(
102103
user
103104
? {
104105
id: user.id,
@@ -136,6 +137,7 @@ const MatchProvider: React.FC<{ children?: React.ReactNode }> = (props) => {
136137
closeSocketConnection();
137138
window.removeEventListener("beforeunload", () => closeSocketConnection());
138139
};
140+
// eslint-disable-next-line react-hooks/exhaustive-deps
139141
}, [matchUser?.id, location.pathname]);
140142

141143
const resetMatchStates = () => {
@@ -220,7 +222,11 @@ const MatchProvider: React.FC<{ children?: React.ReactNode }> = (props) => {
220222
const initMatchRequestListeners = () => {
221223
matchSocket.on(MatchEvents.MATCH_FOUND, ({ matchId, user1, user2 }) => {
222224
setMatchId(matchId);
223-
matchUser?.id === user1.id ? setPartner(user2) : setPartner(user1);
225+
if (matchUser?.id === user1.id) {
226+
setPartner(user2);
227+
} else {
228+
setPartner(user1);
229+
}
224230
setMatchPending(true);
225231
appNavigate(MatchPaths.MATCHED);
226232
});
@@ -237,7 +243,11 @@ const MatchProvider: React.FC<{ children?: React.ReactNode }> = (props) => {
237243
const initMatchingListeners = () => {
238244
matchSocket.on(MatchEvents.MATCH_FOUND, ({ matchId, user1, user2 }) => {
239245
setMatchId(matchId);
240-
matchUser?.id === user1.id ? setPartner(user2) : setPartner(user1);
246+
if (matchUser?.id === user1.id) {
247+
setPartner(user2);
248+
} else {
249+
setPartner(user1);
250+
}
241251
setMatchPending(true);
242252
appNavigate(MatchPaths.MATCHED);
243253
});
@@ -256,7 +266,11 @@ const MatchProvider: React.FC<{ children?: React.ReactNode }> = (props) => {
256266

257267
matchSocket.on(MatchEvents.MATCH_FOUND, ({ matchId, user1, user2 }) => {
258268
setMatchId(matchId);
259-
matchUser?.id === user1.id ? setPartner(user2) : setPartner(user1);
269+
if (matchUser?.id === user1.id) {
270+
setPartner(user2);
271+
} else {
272+
setPartner(user1);
273+
}
260274
setMatchPending(true);
261275
appNavigate(MatchPaths.MATCHED);
262276
});

frontend/src/pages/CollabSandbox/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const CollabSandbox: React.FC = () => {
1616

1717
useEffect(() => {
1818
verifyMatchStatus();
19+
// eslint-disable-next-line react-hooks/exhaustive-deps
1920
}, []);
2021

2122
if (loading) {

frontend/src/pages/Matched/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,14 @@ const Matched: React.FC = () => {
5555

5656
useEffect(() => {
5757
if (timeLeft <= 0) {
58-
accepted
59-
? toast.error(MATCH_UNSUCCESSFUL_MESSAGE)
60-
: toast.error(MATCH_OFFER_TIMEOUT_MESSAGE);
58+
if (accepted) {
59+
toast.error(MATCH_UNSUCCESSFUL_MESSAGE);
60+
} else {
61+
toast.error(MATCH_OFFER_TIMEOUT_MESSAGE);
62+
}
6163
matchOfferTimeout();
6264
}
65+
// eslint-disable-next-line react-hooks/exhaustive-deps
6366
}, [timeLeft]);
6467

6568
if (!matchUser || !partner) {

frontend/src/pages/Matching/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ const Matching: React.FC = () => {
3535
});
3636

3737
return () => clearInterval(timer);
38+
// eslint-disable-next-line react-hooks/exhaustive-deps
3839
}, []);
3940

4041
useEffect(() => {
4142
if (timeLeft <= 0) {
4243
matchingTimeout();
4344
}
45+
// eslint-disable-next-line react-hooks/exhaustive-deps
4446
}, [timeLeft]);
4547

4648
if (!matchCriteria) {

0 commit comments

Comments
 (0)