Code Insights: Adopt Apollo cache for backend code insights fetching
Created by: vovakulikov
Closes part of https://github.com/sourcegraph/sourcegraph/issues/24236 Closes https://github.com/sourcegraph/sourcegraph/issues/25170 Closes https://github.com/sourcegraph/sourcegraph/issues/24788
Context
In this PR https://github.com/sourcegraph/sourcegraph/pull/25236, we have introduced a custom Apollo link that allows to us preserve parallel insights loading.
This PR adopts this Apollo link and changes our UI in order to support Apollo optimistic cache (cache-and-network loading strategy).
Note that our FE aka Built-in insights still work with our custom solution for concurrent requests run - useParallelRequest It's because these insights require 2 search API calls per insight. Our first implementation of apollo link concurrency works only with 1 request per consumer and doesn't support a sequence of requests per consumer. We will get there either by moving these insights and request sequence to our BE or implementation additional logic in Apollo link in a separate PR.
Work in progress
-
Implement useBackendInsight hook with concurrent useQuery
call -
Adopt and change UI according to this ticket https://github.com/sourcegraph/sourcegraph/issues/25170 and Figma designs https://www.figma.com/file/sJwUmtrlU9sTQDafh772Gf/Loading-state-for-background-data-fetching-%2325170?node-id=1119%3A2405 -
Fix storybook and unit tests (add proper mock for Apollo queries)