Paginating preloaded relationships #3303
-
Hi, is there a way to paginate relationship during preload? Example: When a user enters his/her dashboard they see their account info and a list of their posts
Currently this code gives me a "Cannot paginate relationship during preload" error and I came up with this way to get the results I want:
and then I serialize Any help or discussion is welcomed. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
It is true, coz I have never seen a UI where nested resources are paginated. You always paginate between the top level resources and hence paginated nested data is not supported |
Beta Was this translation helpful? Give feedback.
-
In your example in the original discussion, I would query for Posts directly, and filter by User ID in the where clause. That way, the thing you want to paginate on becomes the top level resource in the query. |
Beta Was this translation helpful? Give feedback.
In your example in the original discussion, I would query for Posts directly, and filter by User ID in the where clause.
That way, the thing you want to paginate on becomes the top level resource in the query.