How to fix types of the root API slice .endpoints field, when endpoints are injected lazily #4805
maksnester
started this conversation in
General
Replies: 1 comment 4 replies
-
By definition
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
By injected lazily I mean that I have one root API slice like:
and then all the other slices are added into it like this:
This causes one problem when I need to access endpoint names, e.g. to invalidate tags or initiate request so currently I have to live with the code like this:
technically I can use the
lazyApiSlice.endpoints.getNodes.name
, but if the lazyApiSlice is big and I decide to split some endpoints into different files, then I can't just use lazyApiSlice in these files because lazyApiSlice imports these files itself, so there is a circular reference. I have bigger API slices split like this:I guess I could split things differently and use
and then to keep things exported only from the lazyApiSlice file I could do something like
but IDK, it feels a bit odd and it is nice to have the endpoints list in one place
What I would like to have is the ability to augment the
.endpoints
field of the rootApiSlice in the same way as we augment lazily loaded state slices withor any other way to have correct endpoint names on the rootApiSlice would work I guess
Beta Was this translation helpful? Give feedback.
All reactions