insights: add argument to filter insight views by frozen status
Created by: leonore
part of the work on #33883 (closed)
The current state of insights means that if we want to fetch the number of frozen insights, we need to fetch all insights on the frontend and then filter by their state, which means we are overfetching.
This adds a isFrozen
argument to the insightViews
graphql query such that the frontend can query the backend with something like, "I want all frozen insights", "I want all non frozen insights", or, "I want the first 5 frozen insights".
Test plan
- Created 4 insights, 2 frozen, 2 non-frozen (manually edited in the DB).
- Run some queries in graphQL console:
query insightViews($first: Int, $after: String, $id: ID, $isFrozen: Boolean, $filters: InsightViewFiltersInput) {
insightViews(first: $first, after: $after, id: $id, filters: $filters, isFrozen: $isFrozen) {
nodes {
id
isFrozen
}
}
}
Play with those variables and observe it works:
{
"first":2,
"isFrozen":true
}