Closed aleksandrlat closed 3 years ago
hi @aleksandrlat, thanks for your detailed debugging 👍
I created this PR https://github.com/relay-tools/relay-hooks/pull/153 in draft which should fix your problem.
it is in draft because I have to do further tests but it would be very useful to have your feedback
Looks like some issue after query is skipped in new version 4
Steps to reproduce:
const { retry } = useQuery(query, {}, { skip: false })
const { retry } = useQuery(query, {}, { skip: true })
const { retry } = useQuery(query, {}, { skip: false })
QueryFetcher
returns previously savedQueryFetcher.result
retry
function returned byuseQuery
aboveFetchResolver
because of this condition https://github.com/relay-tools/relay-hooks/blob/v4.0.0/src/FetchResolver.ts#L117environment
andquery.request.identifier
are the sameSteps are complex and this case is rare. But looks like I debugged it correctly. I think there maybe other scenarios when query is not retained after it is disposed on skip because of this condition https://github.com/relay-tools/relay-hooks/blob/v4.0.0/src/FetchResolver.ts#L117