redux-toolkit icon indicating copy to clipboard operation
redux-toolkit copied to clipboard

RTK Query : Code splitting Same endpoint from different slice.

Open visoredd opened this issue 3 years ago • 2 comments

Hi team, Im using RTK Query in my project and recently added injectendPoints for code split my service apis, from emplty api slice.

But I'm having issue as I have multiple external endpoints sometime we face issue of same endpoint name which results in running someother endpoint instead of invoked endpoint that we are using on that page.

Even tried to set overrideexisting endpoint to true , but now previous endpoint doesn't work. How can we use same endpoint names from different external end points.

visoredd avatar Sep 05 '22 08:09 visoredd

injectApis means exactly that: it constructs one api by injecting multiple endpoints into the same api. You cannot use the same name twice. If you would set overrideExistring: true, it would do that: override existing endpoints, throwing their definition away.

You have to use different names for different endpoints.

phryneas avatar Sep 05 '22 09:09 phryneas

That's why earlier I was using multiple api slice but after 30 + api slices I get warning message that middleware doesn't exist. Okay, thanks I'll have to change endpoints name than

visoredd avatar Sep 05 '22 09:09 visoredd