Questions tagged [rtk]

Real Time Kinematic Is a satellite navigation technique used to enhance the precision of position data derived from satellite-based positioning systems (global navigation satellite systems, GNSS) such as GPS, BeiDou, GLONASS, Galileo, etc

106 questions
0
votes
1 answer

Redux toolkit query. useLazyQuery

Try to understand how to structure queries. What I have now: File for CRUD: export const PromoService = apiClient.injectEndpoints({ endpoints: (build) => ({ fetchPromoById: build.query< Promotion, { ppeType:…
Gleb_Sh
  • 1
  • 3
0
votes
1 answer

RTK Query manual cache update without known previous query args

How to make optimistic/pessimistic cache update (probably with updateQueryData), but without knowing the arguments of previous queries? updateQueryData( "getItems", HERE_ARE_THE_ARGUMENTS_I_DONT_HAVE, (data) => { ... } ) For…
avemike
  • 107
  • 1
  • 9
0
votes
1 answer

How to reset Redux toolkit query state (query, not mutation)?

In Redux toolkit query we write as follows in mutations: const [purchase, { isLoading, isError, isSuccess, reset }] = useCreateOneSaleMutation() and we can use the reset method to reset the state. Is there a way I can do the same in the query…
user20779272
0
votes
1 answer

send multiple RTK query request in response of another RTK Query

I am new to RTK Query and when I fetch some data from an endpoint I get a response of an array of objects for each id of item in the list I have to call another API to get the details of each item. but I do not know have to achieve this. for…
Amir Rezvani
  • 1,262
  • 11
  • 34
0
votes
1 answer

How to pass jwt from redux store to middleware

How would I pass a jwt from my redux store into my middleware that then sends a socket.io connect request to my backend? In my React App, I initialize my websocket (using socketIO) via middleware, and then want to validate the socket connection with…
RJA
  • 129
  • 1
  • 7
0
votes
0 answers

How do I remove socket listeners from RTK custom middleware after the middleware has run?

How do I stop listening for socket events in my RTK custom middleware or remove the listeners until the action I am checking for is dispatched again then I add the listener again? I'm currently doing this but I don't know if this is the best…
joel_ace
  • 113
  • 2
  • 10
0
votes
0 answers

redux-toolkit does not allow mutating state in createSlice

My redux toolkit / immer slice is doing a mutation, but that is allowed, why am i getting the mutation was detected error? Is it my reducer? Error: Invariant failed: A state mutation was detected between dispatches, in the path…
Jeremy
  • 1,170
  • 9
  • 26
0
votes
0 answers

Clear the store everytime I change the hash, React

I'm sharing info located on mi RTK store, between two diferentes routes / components. Each view share the element products, that's why when I go from one route to another, if I search something on route 1, and then I go to route 2 this one still…
Dereemii
  • 33
  • 1
  • 6
0
votes
1 answer

Is it possible to updateQueryData on a new nonexistent query - RTK Query?

I've an api created with RTK Query, and I have a create endpoint that pessimistically updates other queries: create: builder.mutation< { id: string }, Req >({ query: (req) => ({ url: "", method: "POST", …
LoyalPotato
  • 401
  • 4
  • 15
0
votes
0 answers

How to export an array from a functional component in react?

I'm trying to learn all the functionalities of react-redux and redux tool kit and in doing so I'm trying to create this demo project. Where data is being shared between sibling components and they work upon that data and return some data. What I…
0
votes
0 answers

RTK startListening will accumulate the effects?

For example: export const authMiddleWare = createListenerMiddleware(); const startAuthMiddleWare = authMiddleWare.startListening as TListener; startAuthMiddleWare({ actionCreator: actionSetToken, effect: (_, {dispatch,…
Evgeniy
  • 303
  • 2
  • 9
0
votes
1 answer

Api with injected Endpoints to Redux RTK query causing "ReferenceError: Cannot access 'baseApi' before initialization"

I have a redux RTK app set up and I did setup a service with RTK query. I noticed though that we will need a lot of endpoints and it looks like the recommended way by RTK Query is to use code splitting to grow the API service. This also went pretty…
Berci
  • 2,876
  • 1
  • 18
  • 28
0
votes
2 answers

RTK query is htting localhost instead of baseUrl

Code below. I console.log the following error via Components/Pages/Scrap.tsx. {status: 'PARSING_ERROR', originalStatus: 200, data: '\n\n \n \n \n\n', error:…
Jason Braswell
  • 301
  • 1
  • 2
  • 7
0
votes
0 answers

how to wrap api in enhanceEndpoints/injectEndpoints with RTK with correct TS?

I have a packet from npm that creates for me basic api with createApi() and in the same file it wraps this api with my custom function with that I can extend it with enhanceEndpoints, it's two different files and ts can't view types that I provided…
Alan
  • 3
  • 1
  • 2
0
votes
1 answer

Store does not update immediately after dispatching an update action

0 I am learning react and redux toolkit , i have a user who has an array of collections , when i add a collection to that user i dispatch an action called updateUser which supposed to update the user store and then i redirect it to another component…
Ghost
  • 318
  • 2
  • 8