Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Lazy PageInfo resolving #155

Open
mxstbr opened this issue Feb 15, 2024 · 1 comment
Open

RFC: Lazy PageInfo resolving #155

mxstbr opened this issue Feb 15, 2024 · 1 comment
Labels
RFC A discussion about a future feature

Comments

@mxstbr
Copy link
Contributor

mxstbr commented Feb 15, 2024

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 mxstbr added the RFC A discussion about a future feature label Feb 15, 2024
@lkuoch
Copy link

lkuoch commented Jul 28, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC A discussion about a future feature
Projects
None yet
Development

No branches or pull requests

2 participants