Skip to content

insights: add argument to filter insight views by frozen status

Administrator requested to merge insights/frozen-filter-insight-view into main

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

  1. Created 4 insights, 2 frozen, 2 non-frozen (manually edited in the DB).
image
  1. 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
}

Merge request reports

Loading