Also, the @cascade solution seems to fall off when used in combination with the first filtering both in GraphQL and GraphQL± (the first directive is applied before the cascade, so if the first element fetched do not satisfy the cascade, the query returns an empty result)
You can get the first n element after cascade using the query variables. You first store the UIDs of nodes which are not filtered out by the cascade directive and then select first n from them. Here is an example of GraphQL± query doing it.
{
u as var(func:has(name)) @cascade
{
name
friend @filter(eq(name, "ashish") {
name
age
}
}
another(func: uid(u), first:10)
{
name
}
}
you can refer to first-n-returns-not-all-the-items