You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What problem does this feature proposal attempt to solve?
The @paginate directive has a standard pattern which would sometimes benefit from an "interface" but this is not provided natively by Lighthouse. An interface would permit use of GraphQL features like fragments.
Which possible solutions should be considered?
the @paginate directive ought to provide an interface based on the type of paginator implemented.
An example fragment might look like this, note the use of a client-side generated field just to highlight some of the utility in doing this:
constPaginatorFragment=gql` fragment standardPaginator on SimplePaginator { paginatorInfo { hasMorePages lastPage @client } }`;constusersList=gql` query usersList( $page: Int $first: Int! ) { users( page: $page first: $first ) data { id name email } ...standardPaginator }${PaginatorFragment}`;
So imagine a standard infinite scroll UI used for multiple data models for which we want the paginator response data to be defined at a single point. An interface is necessary to implement this way.
I tried looking in to the code implementation for paginators but it's not clear to me how or where to modify the implementation to add this interface proposal. I'd like to offer to prepare a PR but I think I'd be lost.
The text was updated successfully, but these errors were encountered:
GregPeden
changed the title
Add interface to implementations of paginator
Proposed feature: Add interface to implementations of paginator
May 25, 2022
What problem does this feature proposal attempt to solve?
The
@paginate
directive has a standard pattern which would sometimes benefit from an "interface" but this is not provided natively by Lighthouse. An interface would permit use of GraphQL features like fragments.Which possible solutions should be considered?
the
@paginate
directive ought to provide an interface based on the type of paginator implemented.The generated paginator type for a hypothetical "users" query would look something like this:
An example fragment might look like this, note the use of a client-side generated field just to highlight some of the utility in doing this:
So imagine a standard infinite scroll UI used for multiple data models for which we want the paginator response data to be defined at a single point. An interface is necessary to implement this way.
I tried looking in to the code implementation for paginators but it's not clear to me how or where to modify the implementation to add this interface proposal. I'd like to offer to prepare a PR but I think I'd be lost.
The text was updated successfully, but these errors were encountered: