Code Insights: Add fix for bad sizing of insights grid layout items
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 |
---|---|
How to test
- Turn off codecov extension or any other external code insights like an extension (like snyk)
- 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