Skip to content

Commit 91600eb

Browse files
iHiDclaude
andauthored
Handle network errors in useSubmissionsList test run fetch (#8475)
When fetching test run data fails due to a transient network error (TypeError: Failed to fetch), remove the submission from the list to reset the UI to a clean state instead of leaving it stuck. Closes #8465 Closes #8467 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2a513bd commit 91600eb

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

app/javascript/components/editor/useSubmissionsList.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,15 @@ export const useSubmissionsList = (
154154
method: 'GET',
155155
})
156156

157-
fetch.then((json) => {
158-
const testRun = typecheck<TestRun>(json, 'testRun')
157+
fetch
158+
.then((json) => {
159+
const testRun = typecheck<TestRun>(json, 'testRun')
159160

160-
set(current.uuid, { ...current, testRun: testRun })
161-
})
161+
set(current.uuid, { ...current, testRun: testRun })
162+
})
163+
.catch(() => {
164+
remove(current.uuid)
165+
})
162166
}, [set])
163167

164168
return { current, create, set, remove }

0 commit comments

Comments
 (0)