Skip to content

Commit

Permalink
Do not retry requests that were aborted
Browse files Browse the repository at this point in the history
  • Loading branch information
peterMuriuki committed Mar 10, 2023
1 parent ac90302 commit 3ea793d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ export const markerColorAccessor = 'marker-color';
export const dateOfVisitAccessor = 'date_of_visit';
export const priorityLevelAccessor = 'priority_level';
export const numOfSubmissionsAccessor = 'num_of_submissions';

// magic strings
export const AbortErrorName = 'AbortError';
3 changes: 2 additions & 1 deletion packages/core/src/services/onaApi/services.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { flatMap } from 'lodash-es';
import {
AbortErrorName,
editSubmissionEndpoint,
formEndpoint,
markerColorAccessor,
Expand Down Expand Up @@ -28,7 +29,7 @@ export const customFetch = async (input: RequestInfo, init?: RequestInit, logger
retryOn: function (_, error, response) {
let retry = false;
const method = init?.method ?? 'GET';
if (error) {
if (error && error.name !== AbortErrorName) {
retry = method === 'GET';
}
if (response) {
Expand Down

0 comments on commit 3ea793d

Please sign in to comment.