Replies: 2 comments
-
|
Oddly, both issues I brought up seem to resolve themselves if I moved the |
Beta Was this translation helpful? Give feedback.
-
|
Hi @soggybeef, can you provide a code example that mainly shows the shouldSkip condition? Considering your problem description, it seems that when you try to execute |
Beta Was this translation helpful? Give feedback.
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
argswill be taken fromrouterwhich is fromnext/routerI have the args for
queryArgasshouldSkip ? skipToken : args. But whenshouldSkip === trueandskipTokenis passed in, the first request is still being made, and this is what i got from my console logs when forming the query in theservicespage where the endpoint is defined:Since the logic of forming my
queryParamsdoesn'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
skipTokenin myinfiniteQuery, thank you!EDIT: I see similar behavior when using
skip: shouldSkipas part of the second argument in myuseInfiniteQuery; the originalargsthat I had became thequeryArgsand the request is sent and returned, but not poulated.Beta Was this translation helpful? Give feedback.
All reactions