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
0 answers

filter an array of objects from an array not working

I have the following code that's intended to filter an array based on id: combineReminders: builder.mutation[]>({ query: ([...reminders]) => ({ url: "/", method: "PUT", body: reminders, }), async…
Mathew
  • 318
  • 11
0
votes
0 answers

RTK mutations not invalidating tags and refetch not working

So I have this query getLoggedInUsersData: build.query({ query: () => `auth/`, providesTags: ["Auth"], }), and this mutation // Select Workspace selectWorkspace: build.mutation({ query: (auth) => ({ …
0
votes
0 answers

Redux toolkit RTK Query: TypeError: Cannot read properties of undefined (reading 'replace')

On page load, I got an error saying "TypeError: Cannot read properties of undefined (reading 'replace')" along with "executeQuery/rejected". No data is loaded. This occurs when I open the page by clicking a side-bar navigation menu (via…
Yozz
  • 435
  • 5
  • 16
0
votes
0 answers

How can I enbale a Redux middleware only when the user is authenticated?

Using RTK in a React.js app, I built a middleware that polls several endpoints and then dispatch to the relevant slices. I want the polling to start only when the user is authenticated. My approach was to get the authentication state with…
JSharles
  • 565
  • 1
  • 5
  • 16
0
votes
0 answers

When using rtk query, the data type received appears as undefined

enter image description here As a result of sending the same request to postman, a normal response was returned. The store setting was also carried out according to the photo. Returning a tuple is requested using mutation , but it still returns…
0
votes
1 answer

can recommend some ways or ideals. we want to modify the trajectory in following figure. and assure trajectory integrate

description: We have an outdoor mobile robot, use RTK+imu+odom algorithm to location and mapping. when RTK is OK, the effect is ok. when no RTK, we use imu+odom to location. problem: As shown in the following figure, while no RTK, we use odom and…
dfagg
  • 1
0
votes
0 answers

RTK-Query - not able to re-fetch after service api return error when conditional fetching with skipToken

Trying to do a conditional fetch when a button click event, it works with the skipToken as mentioned in doc. However, when service return error (ex: 404), fetch wouldn't fire again. Thinking it may be cache is preventing it to re-fetch so update…
TWN
  • 1
  • 1
0
votes
1 answer

How to fetch query only AFTER state is updated

I'm trying to query data from an api by passing it a breed and a sub-breed as arguments. I'm storing these values as state and updating them on button click. Does anyone know how to query the data only AFTER the state has been updated? Because…
ether
  • 91
  • 5
0
votes
1 answer

How do I store value from createApi to redux store?

I'm trying to store an value of an user data(name, email and other) that was fetch using createApi to redux store. But I don't know how to do it and what is the good practice one. userApi.js file export const userApi = createApi({ reducerPath:…
Josh Lee
  • 81
  • 5
0
votes
0 answers

updateQueryData from RTK Query doesn't make update to my state

Hello I'm trying to manualy update Posts in caching when creating now post that I don't want to use invalidatesTags: ['Posts'] because it make many lots of requests but when using updateQueryData to update my state doesn't work even…
0
votes
0 answers

Optimizing number of queries in RTK

On the page, from one endpoint I receive data by different parameters, I can call 4 queries with polling and display new data from them each second. But why do I need to do 4 queries, if from the first it will be clear whether the data has changed…
0
votes
0 answers

Why are new react js files not saving?

I have noticed something about react recently. There are 3 react projects that I am working on. Everything is going well, but the problem is, I can't update new files that I just created in the project. I am using Sanity.io in one of them and I…
0
votes
1 answer

how to access the whole cache in "updateCachedData" RTK Query

I have an infinity scroll in my component. and I update the data in real-time using a web socket connection. imagine I'm getting 10 items for each page and now I'm at page 2. when I want to update one of the items in the 10 first items based on the…
Amir Rezvani
  • 1,262
  • 11
  • 34
0
votes
1 answer

How to set initialState in RTK query?

I am new to RTK and RTK query. I am trying to set up initial configuration using the official documentation. export const pokemonApi = createApi({ reducerPath: 'pokemonApi', baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }), …
0
votes
2 answers

How can I make API calls conditionally using Redux Toolkit query/createApi?

I am only using RTK to make API calls. Not using for any state management stuff like using Slices or Redux Thunk etc. I don't have a clear understanding of those yet... (just a full disclosure) I have tried this: export const gymApi = createApi({ …
Da Moose
  • 111
  • 1
  • 14