Skip to content

web: add `getGraphQLClient` to the `platformContext`

Warren Gifford requested to merge vb/add-apollo-client-to-platform-context into main

Created by: valerybugakov

Context

Preparation to land https://github.com/sourcegraph/sourcegraph/pull/23351. To leverage Apollo-Client cache in different parts of the app, we need to make it available everywhere without global imports. Similar to distributing the requestGraphql function, we can now access getGraphQLClient from the platformContext.

Changes

  • Added getGraphQLClient to the platformContext.
  • Added separate methods to initialize Apollo Client for the web app and the browser extension.
  • Updated default fetch policies for Apollo Client to avoid always serving stale cached data:

Merge request reports

Loading