-
-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot recover from errors via refetch #1553
Comments
Talking about the workaround, we need to know that it will trigger the error the first time in my case beacuse i am sending and undefined data, if it fail again (consecutively) it will not map, because we are mapping or subscribing to the valueChanges obsevable and the value did not change (it will be empty), but when the server turn on again it will trigger because it will diferent (not undefined) if you need to trigger, even if it fail again, you can return a new Date value each time theres and error like it was data, and force a value change (i will do this because and need for a loading view to disapear each time). |
Facing the same issue, is there any progress on fixing that? |
I'm having the same issue, trying to handle errors and recover when using refetch and query valueChanges stops working entirely after an error |
Hello, I'm facing the same issue. https://stackblitz.com/edit/angular-ivy-6yr6hs?file=src/app/app.component.ts When a network error occurs the apollo-angular observable wrapper get into an error state and close the data stream. Using the catchError operator there is no way to prevent this from happening and the valueChanges observable is no longer usable. Refetching data after the error, continue to execute graphql queries on the network but the observable no longer emits new values. I don't know if this behavior is intentional but it makes it difficult to handle this type of errors. |
Also running into this issue, after a server error no more events are emitted.
|
Describe the bug
I am using watchQuery and refetch to update the UI, but if the watchQuery or one refetch fail with an error i can catch the error and the UI refresh the error but the next querys (refetch) dont trigger the maps, subscriptions or catchError and does not refresh the UI (even used async pipe and select pipe).
The request is send to server and the response its ok, but after one error its stops refreshing UI.
I read on apollographql/react-apollo github "Cannot recover from errors via
refetch
orresetStore
#2070" this:"So what happens is:
a) first query returns, error. Picked up by RA, renders.
b) refetch happens (either directly or via resetStore). Due to (a) being an error and 2. above, RA is never informed.
c) refetch query returns. In 1. above, RA compares it to the first query, which has networkStatus === 7, so it throws it away."
To Reproduce
Steps to reproduce the behavior:
Expected behavior
When the second refetch triggers must refresh UI and trigger maps or catchErrros.
Environment:
@apollo/client
: 3.0.0apollo-angular
: 2.0.3graphql
: 15.0.0@angular/core
: 10.0.11@angular/cli
: 10.0.7typescript
: 3.9.5with this other context i worked this same problem too
@apollo/client
: 2.6.4apollo-angular
: 1.10.0graphql
: 14.0.7@angular/core
: 8.2.14@angular/cli
: 8.2.14typescript
: 3.9.5In fact i updated because i was hoping it was resolved.
Additional context
I workaround this by implementing interceptor, with the interceptor I catch every error and return a emtpy HTTP response (return of(new HttpResponse({body: []}));) with this it will always map because it thinks that is always correct and not an error, but when there is an error the data atribute of response in the mapping o subscribe will be undefined (response.data == undefined), meaning an error, if you want you can agregate to the response body an error atribute or the error like it was data.
The text was updated successfully, but these errors were encountered: