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
1
vote
1 answer

How can I clear the RTK cached data manually?

I am using RTK query for data-fetching and I need to clear the cache when the component unmounts. Is that allowed? The problem is, when I open the page, the data is fetched from BE and displayed. The next time when I re-open the same page, the…
Nyi Nyi Hmue Aung
  • 587
  • 1
  • 7
  • 19
1
vote
0 answers

save the results of multiple queries to the same rtk query endpoint

I use RTK Query. I need to make several requests to one endpoint, because for each request(with unchanged arguments) the server will return another pack with air tickets. Please tell me how can I save the results of all calls to the useGetQuery…
stokotlet
  • 11
  • 2
1
vote
1 answer

How to user RTK Query createEntityAdapter to normalize a response that has "meta" and "links" entries

So, I have a response that gets paginated users, and it looks something like this ... { data:[{...}, {...}], links: {first:..., last:...}, meta: {current_page: 1, total: 400, from: 1, to: 10} } Now, when using createEntityAdapter to normalize…
Ruby
  • 2,207
  • 12
  • 42
  • 71
1
vote
1 answer

RTK useLazyQuery always making calls to the API even when called with same params on multiple components

I am trying to make a request use the cached data from another component when doing a lazy query. The parent component (not direct parent, so I don't want to drill down a large data set through props) makes a lazy query through RTK like so: const…
Suaze
  • 33
  • 4
1
vote
1 answer

How to keep the user logged in using RTK Query with no refresh token

I'm using RTK Query for the first time, and I want to keep the user logged in when refresh the page. I'm dealing with an endpoint that doesn't expire the access token (it lasts for a year or so), so there's no refresh token to use or anything, just…
Ruby
  • 2,207
  • 12
  • 42
  • 71
1
vote
2 answers

How to clear RTK Query Cache after querying data?

I want to remove my cache from RTK Query because i am having several search fields into my project and once i use an api search field (rtk query) to search something from an API it give me results but it saves in RTK query cache. After that if i…
Jamal Ashraf
  • 569
  • 6
  • 9
1
vote
0 answers

Proper way to change query argument in RTK Query

Let's say there's child component fetching and rendering posts... const Child = () => { const {data} = useGetPostsQuery({ start: moment().subtract(1, 'months'), end: moment() }) return ( //... {data.map …
loone96
  • 723
  • 2
  • 13
  • 21
1
vote
0 answers

How to integrate optimistic updates with debounce in RTK Query?

I implemented optimistic updates successfully, but couldn't figure out how to use debounce in the process. Take for example just a text input: I want the UI to change immediately, but I don't want to make a post request for each letter typed. I want…
Buski
  • 11
  • 5
1
vote
1 answer

How to make a response interceptor in RTK Query

I need to redirect to log in screen and clear the authentication token when the response status from an API is unauthorized. I could do this in Angular easily by providing an HTTP interceptor to the module, so I'm looking for an equivalent in RTK…
Mahesh Bansod
  • 1,493
  • 2
  • 24
  • 42
1
vote
1 answer

How to update srore after fetching data with RTK

i am learning react js by doing a project wher i am using RTK to manipulate the state of my app . The problem is after fetching data i want my store to change automatically . this is my server import { createApi, fetchBaseQuery } from…
Ghost
  • 318
  • 2
  • 8
1
vote
1 answer

RTK Query selectFromResult causing unnecessary call to the API with undefined argument

I have a query with argument that can be an object or undefined. When I use function selectFromResult in my component, the endpoint is called with argument of undefined. I understood that it should just get the value from the existing data not call…
user3463645
  • 126
  • 1
  • 10
1
vote
1 answer

Rtklib: use rtklib in an android which supports raw measurements to get accurate positions

I am working on a project where I obtain raw gps measurements in a supported Android phone and use rtklib's Android port that is rtk-gps to correct this data with correction from a dgps base station. So my question is - is this achievable using…
user3185008
  • 121
  • 6
1
vote
1 answer

Initializing redux state type checking with Typescript on component level

I coding React Native application using RTK Query with Typescript for state management, I have main slice which holds 3 depth level company object itself and other things like loading state etc. If user login successfully ,I am fetching the company…
amorfati
  • 13
  • 2
1
vote
0 answers

how can I comapre useParams() prev and current value

I am facing a problem where I am fetching different api's based on params?.id. I need to compare the prev and current useParams for an api call using rtkQuery. But it is not recalling my api on useparams change. const { data: pipelineData, …
Wasif Ali
  • 204
  • 1
  • 10
1
vote
1 answer

Redux Tookit, How to dispatch action in a non component function?

I have a global toast, which I am opening using redux slice. I need to open the toast for error message when call from api fails in api-slice of rtk-query. I have seen the answer, using store.dispatch method, but this causes dependency cycle. Is…
Beginner
  • 182
  • 2
  • 14