fuse icon indicating copy to clipboard operation
fuse copied to clipboard

RFC: Lazy PageInfo resolving

Open mxstbr opened this issue 1 year ago • 1 comments

Summary

When using t.connection, I have to always resolve hasNextPage and hasPreviousPage in resolve(), even if either of those fields isn't requested. Example: https://github.com/rauchg/next-ai-news/blob/f766e2c388c4cc9ed74e45ff71ab7fe54436d306/types/Story.ts#L49-L95

Proposed Solution

Some way to define individual resolvers for hasNextPage and hasPreviousPage that only get run if the corresponding fields are actually in the query.

mxstbr avatar Feb 15 '24 14:02 mxstbr

Definitely! I believe this could also be more efficient as well with querying the db only once. This could be done by returning a tuple of the count of items based on the offset as well as the query result.

lkuoch avatar Jul 28 '24 23:07 lkuoch