Skip to content

Code Insights: Add fix for bad sizing of insights grid layout items

Administrator requested to merge vk/fix-insights-grid-layout into main

Created by: vovakulikov

This PR adds a fix for the bad code insights item sizing at the home and search pages. It turned out that react-grid-layout lib behaves very odd when we don't have all items and therefore we don't know how many elements we have. React grid layout can't count them dynamically (by iteration over child array) and requires a number of ids to generate the right grid layout media queries. So, this PR just adds rendering conditions and now the component does not render grid component if it doesn't have all the needed information.

Before After
Screenshot 2021-09-16 at 22 05 58 Screenshot 2021-09-16 at 22 04 39

How to test

  1. Turn off codecov extension or any other external code insights like an extension (like snyk)
  2. Go to any directory page and see correct-sized items.

Note: you need to run the enterprise version of sourcegraph since code insights is part of the enterprise now sg run enterprise-web-standalone

Also to be able to see insights on the directory page you have to turn on "insights.displayLocation.directory": true, flag in your settings

Merge request reports

Loading