Skip to content

Commit 4df4105

Browse files
committed
Fix possible data being null/undefined
1 parent 9c426d4 commit 4df4105

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

frontend/src/routes/Home.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ export default function Home() {
208208
return { data: { job: null } };
209209
})
210210
.then(({ data }) => {
211+
if (!data?.job) {
212+
return;
213+
}
211214
const job: JobMaybe = data!.job;
212215
if ((job === null || currentJob === null) && job !== currentJob) {
213216
if (currentJob) {
@@ -249,7 +252,7 @@ export default function Home() {
249252
setOldJobCount(0);
250253
}
251254
}),
252-
GET("/stats").then(({ data }) => setStats(data!)),
255+
GET("/stats").then(({ data }) => data && setStats(data!)),
253256
]).finally(() => {
254257
setTimeout(() => setLoadCount(loadCount + 1), 1000);
255258
});

0 commit comments

Comments
 (0)