Why doesn't UseLazyQueryTrigger
return a Promise?
#1151
Unanswered
chandlervdw
asked this question in
Q&A
Replies: 1 comment 2 replies
-
The simple answer: it's complex ;) We allow every query to only run once concurrently. So if you were to trigger the query twice in succession very quickly, the first trigger would start the request and the second trigger would skip. So, we return As for your current problem: What about something like this? const firstResult = useLazyQuery(...)
const secondResult = useQuery(..., { skip: !firstResult.isFulfilled }) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Sorry, this is the only place I know to ask questions. I want to be able to use a simple
.then()
as a response to the trigger pulled from the auto-generated useLazyQuery hook but as it stands,UseLazyQueryTrigger
returnsvoid
. Is there some reasoning behind this?This is because I only want to fire the
.then()
once upon completion of the first request. If I can't use that, what's the best combination of props from theUseQueryStateResult
in auseEffect()
to ensure that I only fire the second request once?Beta Was this translation helpful? Give feedback.
All reactions