Skip to content

Commit b7ec7c4

Browse files
fix: improve query retry
1 parent bd94e4f commit b7ec7c4

File tree

2 files changed

+32
-13
lines changed

2 files changed

+32
-13
lines changed

src/components/exam-card.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ export function ExamCard({ exam }: ExamCardProps) {
5252

5353
return data;
5454
},
55+
retry: false,
56+
refetchOnWindowFocus: false,
5557
});
5658

5759
function getExamStatus(): ExamStatus {

src/pages/exam.tsx

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -343,18 +343,21 @@ export function Exam() {
343343
}
344344

345345
if (examQuery.isPending) {
346-
// TODO: Improve this loading
347346
return (
348-
<Center>
349-
<Spinner
350-
alignSelf={"center"}
351-
thickness="4px"
352-
speed="0.65s"
353-
emptyColor="gray.200"
354-
color="var(--dark-blue)"
355-
size="xl"
356-
/>
357-
</Center>
347+
<Box overflowY="hidden">
348+
<Box width={"full"} mt="2em">
349+
<Center>
350+
<Spinner
351+
alignSelf={"center"}
352+
thickness="4px"
353+
speed="0.65s"
354+
emptyColor="gray.200"
355+
color="var(--dark-blue)"
356+
size="xl"
357+
/>
358+
</Center>
359+
</Box>
360+
</Box>
358361
);
359362
}
360363

@@ -377,8 +380,22 @@ export function Exam() {
377380
}
378381

379382
if (!examAttempt || !fullQuestion) {
380-
// TODO: Improve
381-
return <Text>Loading...</Text>;
383+
return (
384+
<Box overflowY="hidden">
385+
<Box width={"full"} mt="2em">
386+
<Center>
387+
<Spinner
388+
alignSelf={"center"}
389+
thickness="4px"
390+
speed="0.65s"
391+
emptyColor="gray.200"
392+
color="var(--dark-blue)"
393+
size="xl"
394+
/>
395+
</Center>
396+
</Box>
397+
</Box>
398+
);
382399
}
383400

384401
const startTimeInMS = examAttempt.startTime.getTime();

0 commit comments

Comments
 (0)