You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Intended outcome:
I am trying to make some reusable Apollo hooks and simplify the APIs with some encapsulation. So my idea is to have the useQuery hook inside of a custom hook (in current case I need actually the useLazyQuery hook). The variables that come to that useLazyQuery hook change, so I need to retrigger it using either main fetch, refetch or fetchMore functions. All of them do not work properly while triggered. Code provided below.
Actual outcome:
Code provided below. So there is a range of issues:
if I use refetch with the same id and a new date, the useLazyQuery calls for the something with the old date that was the initial one (why? no idea...)
if I replace refetch with fetchMore in refetchSomething, the call is actually done properly AT FIRST, but then there is a weird another call without ANY actual source in that hook which calls for something with old date
if I use getSomething in both loadSomething and refetchSomething it works like fetchMore where even tho the function was called only once, the Network tab shows two calls - one with old and second with new data.
I have exactly the same issue with fetchMore. At the first, there is right request with updated after cursor. However, then second request with stale variables is executed.
Intended outcome:
I am trying to make some reusable Apollo hooks and simplify the APIs with some encapsulation. So my idea is to have the
useQuery
hook inside of a custom hook (in current case I need actually theuseLazyQuery
hook). Thevariables
that come to thatuseLazyQuery
hook change, so I need to retrigger it using either mainfetch
,refetch
orfetchMore
functions. All of them do not work properly while triggered. Code provided below.Actual outcome:
Code provided below. So there is a range of issues:
refetch
with the sameid
and a newdate
, theuseLazyQuery
calls for thesomething
with the old date that was the initial one (why? no idea...)refetch
withfetchMore
inrefetchSomething
, the call is actually done properly AT FIRST, but then there is a weird another call without ANY actual source in that hook which calls forsomething
with olddate
getSomething
in bothloadSomething
andrefetchSomething
it works likefetchMore
where even tho the function was called only once, theNetwork
tab shows two calls - one with old and second with new data.How to reproduce the issue:
Here is a code snippet that does not work:
Versions
The text was updated successfully, but these errors were encountered: