Closed as not planned
Closed as not planned
Description
Example:
There is a Entity called Document
.
Schema:
type Query {
documents(first: Int, last: Int): DocumentConnection
}
A query for document
returns the same data, regardless of whether first
or last
is provided.
The culprit:
QuerydslDataFetcher#ScrollableEntityFetcher.getResult
uses the limit
from the subrange that is build out of the arguments. If a cursor is provided using before
or after
it also uses the built subrange's position, which has the intended direction. However in the case where there is no cursor provided, it uses the default subrange's position, overriding the provided direction.
@SuppressWarnings("OptionalGetWithoutIsPresent")
@Override
protected Iterable<R> getResult(FetchableFluentQuery<R> queryToUse, DataFetchingEnvironment env) {
ScrollSubrange subrange = buildScrollSubrange(env);
int limit = subrange.count().orElse(this.defaultSubrange.count().getAsInt());
ScrollPosition position = subrange.position().orElse(this.defaultSubrange.position().get());
return queryToUse.limit(limit).scroll(position);
}