About RPC usage #4228
shurshilov
started this conversation in
General
About RPC usage
#4228
Replies: 1 comment 4 replies
-
@phryneas Please answer :) |
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
-
RTK is great for REST. But I have a new experience using RPC. And I came across the fact that RTKQ either can't work with it or it can, but I don't understand how.
I have a universal reading function on my backend. Which accepts model (aka table db) parameter, an filter(or domain), offset (for pagination), and a limit. And the problems here are 2.
1 I need dynamic types because in one component, for example, I request messages and in the other a list of users with one endpoint. And I don't understand how I can dynamically change the type of RTKQ hook.
2. The problem is that I have various tags for working with invalidate and other things, but I can sort of generate tags with a function based on input parameters, thereby creating tags based on the model parameter.
In fact, there was a 3 problem, this is caching. But I solved it using the
```serializeQueryArgs method: ({EndPointName, queryArgs }) =>`${endpointName}-${query Args?.model} ````
thus just breaking down by model and it works)
Could you describe the solution to these problems? Or is it better to create separate endpoints?
Beta Was this translation helpful? Give feedback.
All reactions