Skip to content

Commit

Permalink
fix: remove use of finally to prevent breaking react native fetch env…
Browse files Browse the repository at this point in the history
…ironments (#1492)

* patch: remove use of finally to prevent breaking react native fetch environments

* fixed to pass tests

* fixed to pass test
  • Loading branch information
benjamincpugh committed Dec 20, 2020
1 parent 2249abf commit 3ffe26e
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/core/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,16 +416,22 @@ export class Query<
if (!isCancelledError(error)) {
getLogger().error(error)
}

// Propagate error
throw error
})
.finally(() => {
// Remove query after fetching if cache time is 0
if (this.cacheTime === 0) {
this.optionalRemove()
}
})

// Propagate error
throw error
}).then(
promise => {
if (this.cacheTime === 0) {
this.optionalRemove()
}
return promise
}
)


return this.promise
}
Expand Down

1 comment on commit 3ffe26e

@vercel
Copy link

@vercel vercel bot commented on 3ffe26e Dec 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.