Remembering URL search parameters? #3106
Replies: 2 comments
-
Coming back to answer my own question: I just noticed that the query hooks return the arguments passed to the query in the |
Beta Was this translation helpful? Give feedback.
-
Ok, follow up question. I have the Maybe I'm overthinking it, right now I have a |
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.
-
When I use RTK Query to make my API call, I provide pagination params (offset and limit), for example:
This works as expected - the request is made with the given
offset
andlimit
parameters.However, now I need to be able to read back the parameters I used, so I can populate my pagination controls - I need to know the offset value to use for the next page based on what I used for this page.
I don't see this anywhere in the Redux store managed by RTK Query, is it possible to have RTK Query remember these params or will I need to remember these somewhere else?
I did see the information from the docs here: https://redux-toolkit.js.org/rtk-query/usage/pagination however I need these parameters for more than just pagination; we use them for filtering and sorting params as well. If we kept it in local component state as in that example, if we leave and come back that state is lost, and since it's not persisted in the store we would lose the filter and sort options.
Am I better off persisting this extra information somewhere else?
Thanks again!
Beta Was this translation helpful? Give feedback.
All reactions