-
Notifications
You must be signed in to change notification settings - Fork 786
Wrapped component never gets updated after an error #1229
Comments
This issue has been automatically labled because it has not had recent activity. If you have not received a response from anyone, please mention the repository maintainer (most likely @jbaxleyiii). It will be closed if no further activity occurs. Thank you for your contributions to React Apollo! |
Hey ! |
BUMP - this is an important issue with v2 - can someone please look at this? Basically data.error is not cleared on refetch. |
We’re seeing this as well with newer versions of dependencies: |
I'm seeing the same problem with React-Apollo 2.0. The wrapped components are not re-rendered after |
related to apollographql/apollo-client#2513 |
Setting |
Did anyone found a workaround for it? |
@slonoed you can change
by
around line 560 of It will pass a |
@Jay1337 thanks! I don't really want to change library code. Also, I'm curious: |
I don't have time for a PR and I don't think it would be merged (since
maintainers don't seem to have time for github issues...).
You can fork the repo and apply my patch if you need it.
I forgot to mention that the retry function will be available only when
there is an error (this.props.data.error = true).
Le 23 janv. 2018 15:39, "Dmitry Manannikov" <[email protected]> a
écrit :
… @Jay1337 <https://github.com/jay1337> thanks! I don't really want to
change library code.
Did you consider to make a PR?
Also, I'm curious:
Is it possible to spin up a new query from app code?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1229 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACBSLSK0_dGo06FtityoWTaMKOAlfyAuks5tNe8IgaJpZM4P1IG2>
.
|
any news about this issue? I'm experiencing it as well with freshly installed apollo client:
|
I'm also experiencing this. |
Hi everyone! PR #3107 solves the problem of resubscribing to the observable after all errors. If anyone still wants to pursue an explicitly 'retry' mechanism, I suggest that you make an issue here: https://github.com/apollographql/apollo-feature-requests/issues Thanks! |
Intended outcome:
I have a React component wrapped with the
graphql
function to get data from a GraphQL query.The query is called on mounting, on
this.props.data.refetch()
, or at some time ifpollInterval
is set.If any of these calls fails, I expect the component to be updated if a new call succeed, so that:
data.error
prop changes toundefined
and the component gets updated with the data received.pollInterval
is set and if at some point the network connection is lost, then when the connection is back the polling works as if the connection was never lost. So I want the polling to continue even if a poll has failed in the past and I want the component to be updated if new data is available (coming from a new poll of the same request or from the result of any other query or mutation in the app)Actual outcome:
After an error,
data.error
remains defined and component never gets updated, even ifdata.refetch
is called or ifpollInterval
is set.My understanding:
Basically, when there is a network error, observers are unsubscribed. Thus any refetch only update Apollo store but does not trigger a rerender of the component.
I think it's the expected behaviour of the
cleanupSubscription
call in https://github.com/apollographql/apollo-link/blob/master/packages/zen-observable-ts/src/zenObservable.tsWhich is called through
obs.error(error)
in https://github.com/apollographql/apollo-client/blob/master/packages/apollo-client/src/core/ObservableQuery.tsBut I think
react-apollo
should resubscribe to the query after an error to keep the component updated when new data arrive in the cache (after adata.refetch
, a poll, or any other query or mutation in the app).Version
This is the issue asked here apollographql/apollo-client#1186 (comment)
The text was updated successfully, but these errors were encountered: