Skip to content

Commit ac9d659

Browse files
committed
fix(submissions): disable retries and refetching for useLastSubmissionForUser
1 parent e275aba commit ac9d659

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

src/hooks/submissions.ts

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,29 @@ export function useLastSubmissionForUser(
103103
) {
104104
const { token } = useToken();
105105

106-
return useQuery<{ code: string }, Error>(`last-submission`, async () => {
107-
if (benchmarkId && language) {
108-
const { data } = await axios.put(
109-
`${process.env.REACT_APP_API_ENDPOINT}/submissions`,
110-
{
111-
benchmarkId,
112-
language,
113-
},
114-
{
115-
headers: {
116-
Authorization: `Bearer ${token}`,
106+
return useQuery<{ code: string }, Error>(
107+
`last-submission`,
108+
async () => {
109+
if (benchmarkId && language) {
110+
const { data } = await axios.put(
111+
`${process.env.REACT_APP_API_ENDPOINT}/submissions`,
112+
{
113+
benchmarkId,
114+
language,
117115
},
118-
},
119-
);
120-
// console.log(data);
121-
return data;
122-
}
123-
});
116+
{
117+
headers: {
118+
Authorization: `Bearer ${token}`,
119+
},
120+
},
121+
);
122+
return data;
123+
}
124+
},
125+
{
126+
retry: false,
127+
refetchOnReconnect: false,
128+
refetchOnWindowFocus: false,
129+
},
130+
);
124131
}

0 commit comments

Comments
 (0)