menu

Apollo

A community of developers, designers and others who love Apollo and GraphQL. 🚀

Channels
# All channels
view-forward
# General
view-forward
# Apollo Angular
view-forward
# Announcements
view-forward
# Apollo Android
view-forward
# Apollo Client
view-forward
# Apollo iOS
view-forward
# Apollo Link
view-forward
# Apollo Link Rest
view-forward
# Local State
view-forward
# Apollo Studio
view-forward
# Apollo Server
view-forward
# Apollo Tooling
view-forward
# Contributing
view-forward
# Docs
view-forward
# Events
view-forward
# GraphQL Tools
view-forward
# Jobs
view-forward
# Random
view-forward
# React Apollo
view-forward
# Showcase
view-forward
# Subscriptions
view-forward
# Testing
view-forward
# Vue Apollo
view-forward
Team

How to poll silently, update cache and avoid rerending

July 11, 2020 at 7:56am

How to poll silently, update cache and avoid rerending

July 11, 2020 at 7:56am
Hi all,
I am using React Apollo in a react native app. One of the screens on this app relies on data being fetched from the server of a list of items. App.js looks like the following at the end:
const WithProvider = () => ( <ApolloProvider client={client}> <Rehydrated> <AppContainer /> </Rehydrated> </ApolloProvider> );
export default WithProvider;
Because AppContainer is always mounted, I would like to attach a useQuery hook to poll the server every few seconds. It currently works, however, no matter the screen where a user is, when it resolves it rerenders (resets) the entire app and takes the user at the first screen.
Is there any way to poll for stuff silently? I know by design useQuery will cause a rerender but i'm wondering what trick to use to achieve the same in the background.
Thanks!
No messages yet