diff --git a/lib/apollo.js b/lib/apollo.js index c95af0af..cc4aad54 100644 --- a/lib/apollo.js +++ b/lib/apollo.js @@ -3,6 +3,7 @@ import { BatchHttpLink } from '@apollo/client/link/batch-http' import { decodeCursor, LIMIT } from './cursor' import { COMMENTS_LIMIT, SSR } from './constants' import { RetryLink } from '@apollo/client/link/retry' +import { isMutationOperation, isQueryOperation } from '@apollo/client/utilities' function isFirstPage (cursor, existingThings, limit = LIMIT) { if (cursor) { const decursor = decodeCursor(cursor) @@ -37,7 +38,8 @@ const retryLink = new RetryLink({ attempts: { max: Infinity, retryIf: (error, _operation) => { - return !!error + // retry only if the error is not a mutation and the operation is a query + return !!error && !isMutationOperation(_operation.query) && isQueryOperation(_operation.query) } } })