Replies: 1 comment
-
Oddly, both issues I brought up seem to resolve themselves if I moved the |
Beta Was this translation helpful? Give feedback.
0 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.
Uh oh!
There was an error while loading. Please reload this page.
-
Language: Typescript
Version:
"@reduxjs/toolkit": "^2.3.0",
I was trying to conditionally run an infinite query to prevent the first request from being made upon mounting of the component. The
args
will be taken fromrouter
which is fromnext/router
I have the args for
queryArg
asshouldSkip ? skipToken : args
. But whenshouldSkip === true
andskipToken
is passed in, the first request is still being made, and this is what i got from my console logs when forming the query in theservices
page where the endpoint is defined:Since the logic of forming my
queryParams
doesn't and shouldn't take into account theskipToken
, the request is still being sent in to fetch data that i don't want to fetch. This data is returned, but not returned or populated to my parent component. But I see it under the Responses in my Network Requests.Would love any tips and corrections on how I can better handle the
skipToken
in myinfiniteQuery
, thank you!EDIT: I see similar behavior when using
skip: shouldSkip
as part of the second argument in myuseInfiniteQuery
; the originalargs
that I had became thequeryArgs
and the request is sent and returned, but not poulated.Beta Was this translation helpful? Give feedback.
All reactions