You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We (possibly weirdly) combine this library with React-Relay-offline to persist queries to local/async storage.
I was trying to prevent the middlewares completing in the event of an error, so that the cache isn't updated. My last middleware function ("last" meaning furthest from the fetch result) looks like this
export const blockCacheOnErrorMiddleware = () => (next: MiddlewareNextFn) => async (
req: RelayRequestAny
) => {
const res = await next(req)
// simple fn to grab the error from either a batch or single response
const error = getFirstErrorFromRes(res)
if (error) {
return new Error('Error received from Relay response')
}
return res
}
This works great for what I need as far as I can tell. However, I am getting (unsurprisingly) an unhandled Promise exception in the console:
backend.js:32 Possible Unhandled Promise Rejection (id: 0):
RelayNetwork: No data returned for operation `ExampleQuery`, got error(s):
(No errors)
Is there a better way of handling this situation? I had a look at your example source code and couldn't see any similar use-cases
The text was updated successfully, but these errors were encountered:
We (possibly weirdly) combine this library with React-Relay-offline to persist queries to local/async storage.
I was trying to prevent the middlewares completing in the event of an error, so that the cache isn't updated. My last middleware function ("last" meaning furthest from the fetch result) looks like this
This works great for what I need as far as I can tell. However, I am getting (unsurprisingly) an unhandled Promise exception in the console:
Is there a better way of handling this situation? I had a look at your example source code and couldn't see any similar use-cases
The text was updated successfully, but these errors were encountered: