Hi everyone, can someone give me some advice in or...
# orm-help
h
Hi everyone, can someone give me some advice in organising my queries? I am using React Apollo client with Apollo Server + prisma in backend. Suppose I have a
me
query that returns a
User
object with a
posts
field that return all the posts from a user. I also have a top-level
posts
query for general posts queries. It is pretty easy to implement pagination with the top-level queries, but seems a lot more troublesome with the sub-field query. So, if you were me, would you 1) Write a new top-level query
myposts
. This may lead to more duplicated codes. In the backend. Also in the frontend, one more
refetchQueries
has to be done after each mutation. 2) Implement pagination with incremental fetching inside object in the frontend. This would bring complicated arguments into backend’s subfield. Also more complicated logics in frontend. 3) Fetch all
myposts
at once and do client-side pagination only.