Skip to content
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

useQuery/useLazyQuery stuck on "loading" state in expo/react-native devices #9689

Closed
dominik-myszkowski opened this issue May 6, 2022 · 14 comments
Assignees

Comments

@dominik-myszkowski
Copy link

dominik-myszkowski commented May 6, 2022

In latest versions of Expo React Native (also newest versions of Apollo Client for React) useQuery no longer works. Any query executed with Apollo client works well in the web, but on mobile devices (both real device and emulator) is stuck on "loading" state. No error is returned.

Intended outcome:

Execute a query with apollo client on new expo application. Receive data.

Actual outcome:

Query is executed but stuck on "loading". Both useQuery and useLazyQuery. The properties of object returned by useQuery are as follows: data - undefined, error, undefined, loading - true.

How to reproduce the issue:

  1. Create an Expo project (https://reactnative.dev/docs/environment-setup)
  2. Add Apollo Client and configure it (https://www.apollographql.com/docs/react/integrations/react-native/)
  3. Start the project and run in on Android device

The example project recommended on Apollo website, after upgrading the libs to newest versions, is not working to (no data is shown after application start - always loading). https://github.com/GraphQLGuide/guide-react-native

Versions

System:
OS: Windows 10 10.0.19044
Binaries:
Node: 16.14.2 - E:\Tools\Node\node.EXE
npm: 8.5.3 - E:\Tools\Node\npm.CMD
Browsers:
Chrome: 100.0.4896.127
Edge: Spartan (44.19041.1266.0), Chromium (101.0.1210.32)
npmPackages:
@apollo/client: ^3.2.1 => 3.6.2

@benjamn benjamn self-assigned this May 6, 2022
@Off2Race
Copy link

Off2Race commented May 6, 2022

I'm having a similar problem. My app is currently on Apollo Client 3.5.9 and working great. I originally upgraded to 3.6.2 and suddenly all my queries stopped working. I backtracked versions and discovered that the problem started with 3.5.10. If I run on 3.5.9, everything is great. If I upgrade to 3.5.10, all my useQuery calls effectively stop working. The loading in the response is always true and no data is ever returned.

I have no idea why the changes in 3.5.10 make a difference but I can reliably reproduce the issue simply by upgrading my app from 3.5.9 to 3.5.10. If I go back to 3.5.9, all is good.

@estiventhneira
Copy link

Same issue here, I had to downgrade the version for solve it

@Off2Race
Copy link

Off2Race commented May 6, 2022

Hi, @benjamn – Based on your suggestion in #9668, I tried upgrading to @apollo/client@next (3.6.3) but that didn't help. Same issue.

@volkandogan
Copy link

+1

1 similar comment
@mjcarnaje
Copy link

+1

@ntaboada
Copy link

ntaboada commented May 8, 2022

Hope this helps:
i've been struggled with this issue the last 4 days trying ALMOST everything. After upgrading my expo libs my app stopped working. The solution was reverting back to "@apollo/client": "3.5.0".
Now i can smile
again :P

@darrylyoung
Copy link

It also works for me if I downgrade to version 3.5.10. Has anyone else tried the upcoming version 3.6.3? I just tried it but it still wasn't working for me.

@dominik-myszkowski
Copy link
Author

Looks like a common and definite bug.
https://stackoverflow.com/questions/72083468/loading-remains-true-when-loading-data-with-usequery-using-apolloclient-in

For me it is still working on following versions setting:

"@apollo/client": "^3.2.1", "apollo3-cache-persist": "^0.6.0", "expo": "~44.0.0", "graphql": "^15.3.0", "react": "17.0.1", "react-dom": "17.0.1", "react-native": "0.64.3",

@Ryan-cyi
Copy link

+1

1 similar comment
@mijkal
Copy link

mijkal commented May 10, 2022

+1

@SimenB
Copy link
Contributor

SimenB commented May 10, 2022

This is a duplicate of #9668

@dominik-myszkowski
Copy link
Author

Looks like new alhpa version solves the case. (3.7.0-beta.3)

npm i @apollo/client@beta

#9668 (comment)

@fatuheva
Copy link

fatuheva commented Jan 25, 2023

I'm still seeing this problem with apollo/client 3.7.5 and react version 18, expo version 47. The "loading" var is forever in true state and both data and error are undefined. I used fetch with same url and headers and was able to fetch the data, so do think this is apollo client related.
Edit: The problem was elsewhere , seems to be working fine now.

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
For general questions, we recommend using StackOverflow or our discord server.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests