Skip to content

Code Insights: Fetch only needed fields in insight view data (chart content query)

Administrator requested to merge vk/fix-get-insight-view-fetching-gql into main

Created by: vovakulikov

Background

This PR just removes unused fields from the insight data view GQL query. This though has a few important implications that I want to highlight here

  • We do not load unnecessary data (this is obviously a good thing)
  • This PR insight view query does not re-trigger the insight configuration query. Prior to this PR if you open the insight standalone insight page you could notice that we have two requests to the backend to fetch insight configuration info (GetInsights query). This was happening because GetInsights fetches info about applied filters and they usually have a default value (null values) and then GetInsightView also queries applied filters info but in this time API returns applied filters that are not null values because we passed some filters in this. And this retriggers the FE cache and we have two network requests for the same data that we already have on the FE.
Screenshot 2022-07-06 at 13 17 39

Test plan

  • Make sure that we don't have extra network requests around insight configuration and insight data on the dashboard and standalone insight pages.

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading