Skip to content

Help migrating from RTK to RTKQ, selecting data from RTKQ  #4441

@fhanggi

Description

@fhanggi

Hello
I'd like to migrate from just RTK to RTKQ.
I have a scenario where i am struggling. I have a search form with about a dozen search parameters. the api accepts any combination of search criteria. i make an api call on the search form using thunks/redux and put the result into one redux slice. it doesn't matter what search criteria is used the data will always be in the same place in the store.
then in multiple other components i use useSelector to access the search results.

With RTKQ i know i can access the results also in redux but the query signature always changes if the search criteria changes.
i.e. there is always a new query in the store where the data sits. So it is difficult to get to that data . i think i would have to store the search criteria in redux and then use those in the other components to find the query or "re-execute" the query.

is there a way to always put the results into the same location in the store in RTKQ. i.e. basically ignoring the arguments . this is how it works right now for me just using RTK

or is there an easier way to find the data in RTKQ. like when a new search is made can i "kill" all the existing queries that start with the same query name "fetchApplicationsBySearchCriteria" so i always only have one and then maybe there is a way to find that in state without knowing the parameters that were used?

btw i don't want any caching because this is a multi user app so a search should always get the latest data.

Any help would be greatly appreciated.

Thank you
Fabian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions