useQuery/useLazyQuery stuck on "loading" state in expo/react-native devices
See original GitHub issueIn 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:
- Create an Expo project (https://reactnative.dev/docs/environment-setup)
- Add Apollo Client and configure it (https://www.apollographql.com/docs/react/integrations/react-native/)
- 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
Issue Analytics
- State:
- Created a year ago
- Reactions:11
- Comments:12 (1 by maintainers)
Top GitHub Comments
Looks like new alhpa version solves the case. (3.7.0-beta.3)
npm i @apollo/client@beta
https://github.com/apollographql/apollo-client/issues/9668#issuecomment-1121656608
It also works for me if I downgrade to version
3.5.10
. Has anyone else tried the upcoming version3.6.3
? I just tried it but it still wasn’t working for me.