feat(upload): state-based retry tracking and resilient gateway error handling (#509)

* feat(upload): state-based retry tracking and resilient gateway error handling

* fix(upload): check non-retryable statuses before offline state in isNetworkIssue
This commit is contained in:
Yiling-J
2026-10-31 10:37:35 +08:00
committed by GitHub
parent 9529c63c0a
commit 77bd1422d8
6 changed files with 727 additions and 67 deletions
@@ -358,7 +358,7 @@ describe('MobileFileBrowser', () => {
window.XMLHttpRequest = originalXhr
})
it('fails upload and confirms with error on network failure', async () => {
it('keeps upload active and does not fail task on network failure', async () => {
const originalXhr = window.XMLHttpRequest
const patchMock = vi.fn().mockResolvedValue({ ok: true, json: async () => ({}) })
@@ -409,17 +409,13 @@ describe('MobileFileBrowser', () => {
fireEvent.change(fileInput, { target: { files: [testFile] } })
await vi.waitFor(() => {
expect(patchMock).toHaveBeenCalledWith(
expect.objectContaining({
param: { teamId: 'team-1', taskId: 'task-3' },
json: expect.objectContaining({
fileId: 'server-file-3',
errorMessage: expect.any(String),
}),
}),
)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expect((client.api.teams[':teamId'].upload.tasks as any)['$post']).toHaveBeenCalled()
})
// Network failures are retried automatically with backoff and do not fail task on server
expect(patchMock).not.toHaveBeenCalled()
window.XMLHttpRequest = originalXhr
})