Code Insights: [FE] Load and render insights partially based on their visibility in the viewport
Created by: vovakulikov
Closes part of https://github.com/sourcegraph/sourcegraph/issues/29024
Context
Prior to this PR, we load all insights cards on the dashboard. We do that partially in parallel by 2 but still, we load every chart/card on the page even if they do not fit in the viewport (if they're not visible).
With these PR changes, we load and render insights only if they are visible and fit in the visible area. It isn't real virtualization because we still render empty cards (this is still needed for react-grid-layout layout processing) but it reduces the amount of network requests dramatically and makes it a little bit easier for the browser to render cards on the page (because cards outside of the viewport do not have heave content with many elements within the card)
Loom video about this change https://www.loom.com/share/13299acd03f244a2b352d5185def0912