Open Krasnopir opened 3 years ago
fetchMore also does not return loading true. Only with apollo client settings fetchPolicy: 'cache-and-network', then loading is true after every call. But in this case i have another problem (maybe it must be another issue) - fetchMore send two requests, first with new variables, and then with start query variables.
useEffect(() => {
if (!called) {
getTracks({ variables: getQueryVariables() });
} else {
fetchMore({
variables: getQueryVariables(),
updateQuery: (prev, { fetchMoreResult }) => {
if (!fetchMoreResult) return prev;
return fetchMoreResult;
},
});
}
}, [JSON.stringify(urlQueries)]);
Same issue. loading
is always false using useLazyQuery
Same issues:
"cache-and-network"
, when fetchMore
is called, it will make two different queries to the backend."cache-first"
policy, when fetchMore
is called, it won't update loading
(but it doesn't suffer from the first issue).Same issue. ` const [getJobAd, getJobAdRes] = useLazyQuery(GET_JOB_AD);
useEffect(() => { if (router.query.id !== 'new' && router.query.id) getDetail(router.query.id as string); }, [router]);
const getDetail = async (jobAdId: string) => { try { getJobAd({ variables: { id: jobAdId } }); console.log(getJobAdRes, getJobAdRes.loading); } catch (error) { console.log(error); } };`
getJobAdRes ={ "loading": false, "networkStatus": 7, "called": false }
I have the same issue,
"@apollo/client": "^3.5.10",
"@apollo/react-hooks": "^4.0.0",
The loading status change from false
to true
in the first call, but after that doing refech is always false
, and checking the networkStatus
it's always 7
so I'm not able to get the loading correct status.
Hello. I try to use hook useLazyQuery to filter data with new variables. apollo client config for watch query is fetchPolicy: 'cache-and-network',
When i set new variables at first time - refetch does not trigger loading as true and networkStatus always 7. But refetch with repeated variables return loading true, as i need.
I tried different fetchPolicy setting, and only with 'cache-and-network' and repeated variables returned loading true on refetch. Also it does not suit me to set notifyOnNetworkStatusChange, because i need to show previous result before data will update, and spinner for loading over.