Stale data, when fetching with new variables

We are building an app like instagram. Whenever we visit a user page, we need to fetch that users posts and show them, and this is paginated as well.

The query has following variables {skip: 0, limit: 10, userId: "xyz"}, and we are using “notifyOnNetworkStatuscahnge”, to show loading at the end of the list. Here we are not showing loading before rendering the main component. Loading is being handled by “Flatlist” component in react native, and if no data is present we are sending empty list to Flatlist.

When I visit a user profile screen for first time everything is working as expected, but when I visit a new user profile, previous user data is being show till the new data is loaded. As we are not using(can’t use becoz refetch will make whole UI state as loading) loading to return a loading state before returning list, its not working as expected.

How can I make apollo query return undefined while loading for new variables instead of returning stale data of previous user.

Hi @Narendra_Manchala , have you seen our docs on the Core pagination API? You probably need to define a field policy where the keyArgs is set to true.