Combine RTK Query Base Queries #3161
EskiMojo14
started this conversation in
Community Recipes
Replies: 1 comment
-
wondering if it might be more intuitive to run the cases from right to left, since the default needs to be the first parameter - currently with the only code change would be - for (const { predicate, baseQuery } of caseBQs) {
+ for (const { predicate, baseQuery } of caseBQs.reverse()) { |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Something that came up today - being able to combine separate base queries, for example FetchBaseQuery and a custom GraphQLBaseQuery, and providing a predicate to determine which base query should be called (based on the arguments provided).
My original approach was the below:
However, I later came up with the below recipe to make it reusable.
There are a few things to note for the above:
BaseQueryApi
,BaseQueryArg
,BaseQueryError
,BaseQueryExtraOptions
,BaseQueryResult
) which would need to be imported from'@reduxjs/toolkit/dist/query/baseQueryTypes'
Beta Was this translation helpful? Give feedback.
All reactions