I still haven't found a moment to look into the exact cases that
causes this error, but we're not loosing any information this way.
In fact, it will be easier to find the right information as we only
need to look to one entry in Sentry.
We need to preload the ancestors of search results after applying
pagination limits. This way the search results itself are paginated,
but not the ancestors.
If we don't do this, we might not preload a parent group of a search
result as it has been cut off by pagination.
When filtering we want all to preload all the ancestors upto the specified
parent group.
- root
- subgroup
- nested-group
- project
So when searching 'project', on the 'subgroup' page we want to preload
'nested-group' but not 'subgroup' or 'root'
By preloading the count of members, projects and subgroups of a group,
we don't need to query them later.
We also preload the entire hierarchy for a search result and include
the counts so we don't need to query for them again