-
Notifications
You must be signed in to change notification settings - Fork 787
currentObservable.query.getCurrentResult is not a function #3148
Comments
I'm seeing the same thing on v2.5.7. It looks a change was recently made to apollo-client that adds the |
2.6.3 does indeed fix it. Thanks. I will leave this open due to 2.5.7 issue @GreenGremlin mentioned. |
Thanks for reporting this. |
RA 3 is dependent on changes made in `apollo-client` 2.6.3. Fixes #3148.
Peer dependencies are not enforced, which means consumers pinned to react-apollo 2.5.x apollo-client 2.5.x are broken. It seems unfortunate that what is essentially a breaking change, for some users, was released in a patch release. |
Definitely a fair point @GreenGremlin. We were a bit anxious to get issue #3090 fixed, since it's impacting quite a few users (and is cropping up in other open issues). But I agree, this is unfortunate. I can revert the changes for that PR and publish a new version, but I'm wondering which option people would prefer. To have #3090 fixed now in |
Actually, I'll do this another way - I'll make the required changes from (I'll leave things the way they are in RA 3) |
@hwillson that sounds like a great solution. Thanks! |
To fix issue #3090, the `ObservableQuery.resetQueryStoreErrors` method was introduced in `apollo-client` 2.6.3. While `apollo-client` 2.6.3 is a peer dep of the latest version of `react-apollo` (2.5.7), people who can't update their version of `apollo-client` to >= 2.6.3 are running into issues when updating to the latest version of `react-apollo`, since `ObservableQuery.resetQueryStoreErrors` isn't available to them. Since we can't enforce the version of `apollo-client` people are using, this commit adjusts the `Query` component to only use `resetQueryStoreErrors` if it's available. If it isn't, it will call into the `ObservableQuery`'s private API to do the same things as `resetQueryStoreErrors`. This is a hack, but it is temporary as `react-apollo` is launching soon, and will enforce a minimum `apollo-client` version of 2.6.3 (so this workaround won't be needed). Fixes #3148.
@GreenGremlin I've wired up a solution in #3151 that should hopefully give us the best of both worlds. It's a hack for sure, but if using |
* Conditionally use AC's `ObservableQuery.resetQueryStoreErrors` To fix issue #3090, the `ObservableQuery.resetQueryStoreErrors` method was introduced in `apollo-client` 2.6.3. While `apollo-client` 2.6.3 is a peer dep of the latest version of `react-apollo` (2.5.7), people who can't update their version of `apollo-client` to >= 2.6.3 are running into issues when updating to the latest version of `react-apollo`, since `ObservableQuery.resetQueryStoreErrors` isn't available to them. Since we can't enforce the version of `apollo-client` people are using, this commit adjusts the `Query` component to only use `resetQueryStoreErrors` if it's available. If it isn't, it will call into the `ObservableQuery`'s private API to do the same things as `resetQueryStoreErrors`. This is a hack, but it is temporary as `react-apollo` is launching soon, and will enforce a minimum `apollo-client` version of 2.6.3 (so this workaround won't be needed). Fixes #3148. * Changelog update
|
I had the same issue using "@apollo/react-hooks:0.1.0-beta.10". Upgrading |
+1 for @apollo/react-hooks |
@jcane86 you can force appsync to resolve to apollo-client 2.6.3 add the following to your package.json "resolutions": {
"apollo-client": "2.6.3"
} |
yesss! @pffreitas you're a hero! Cheers for that, it works |
@jcane86 his solution still didn't fix it for me (with appsync), did you change anything else? |
@idanlo I believe I just did a yarn install and restarted the dev server. Are you still getting the same error about getcurrentresult? |
@jcane86 I get a warning that says |
I'm sorry, I can't help you with that, I'm not familiar with local
resolvers.
It looks like the original issue is solved though. Maybe open a new issue
with your particular issue to get more attention to it?
…On Tue, 23 Jul 2019, 13:26 Idan Lottan, ***@***.***> wrote:
@jcane86 <https://github.com/jcane86> I get a warning that says Found
@client directives in a query but no ApolloClient resolvers were specified.
This means ApolloClient local resolver handling has been disabled, and
@client directives will be passed through to your link chain.
I think it doesn't recognize my resolvers with apollo-link-state because
it was deprecated in apollo-client v2.5 but the appsync client does not
receive any resolvers
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3148?email_source=notifications&email_token=AAFSHCVJU2NTC6BJVDFXXSDQA4WKVA5CNFSM4H2UYEE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2TVVMQ#issuecomment-514284210>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFSHCTK5EIOWOTI7OVOZ5LQA4WKVANCNFSM4H2UYEEQ>
.
|
@jcane86 this is a problem with aws-appsync, they are still with apollo-client version <2.5, there is issue open there already for 4 months and no contributor has responded |
Attempting to use an HOC for auth and the Query component now rapidly makes calls to the backend causing it to trigger a rate limit in my app. Am I calling it wrong? Or am I calling Query wrong?
|
I'm using react, appsync and apollo. I encountered this error. My react-apollo was 3.0.0 and apollo-client 2.6.3. I found the solution was to change react-apollo to |
Following what @dctanner and @pffreitas built upon (thank you both) Current versions/steps for working queries: Then also add the resolution: You will get |
Using Apollo-Boost, it looks like one would need to update to 0.4.4 to resolve the issue. Can someone confirm, in case it is helpful? |
This seems to be related to this issue: #3365 |
Same issue. I am running apollo-boost 0.3.1. It did indeed fix the issue by upgrading to 0.4.4. |
@jcane86 I'm using AppSync as well and none of the solutions below workes for me. Any news in this sense? |
With exactly the same setup, useMutation works for me. However, useQuery throws currentObservable.query.getCurrentResult. Any solution? |
Has anyone got this working with AppSync & @apollo/react-hooks ? |
@manicode097, #3148 (comment) should work and need yarn/npm install after modifying package.json @stewartduffy Got this working by using custom hydrate function and
|
@stewartduffy I also got this working. A difference from @Nisfan is that I had I can testify that by manually upgrading to:
Worked. I'm also using appsync. Here's part of my package.json:
Dev dependencies:
|
For whatever the reason, if you are not using Yarn, the If you're using npm, add in
Delete the entire This will force all the dependencies inside package.json to reference the apollo-client package correctly. And then: |
Intended outcome:
I was trying to upgrade to the new 3.0.0-beta.2 with this repo:
https://github.com/mfpiccolo/react-apollo-realworld-example-app
Actual outcome:
TypeError: this.currentObservable.query.getCurrentResult is not a function
FullTrace:
How to reproduce the issue:
Clone the project,
npm i && npm start
Version
3.0.0-beta.2
The text was updated successfully, but these errors were encountered: