{"size": 877, "ext": "js", "max_stars_repo_path": "app/assets/javascripts/design_management/graphql.js", "max_stars_repo_name": "sysdl132/gitlabhq", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/assets/javascripts/design_management/graphql.js", "max_issues_repo_name": "sysdl132/gitlabhq", "max_issues_repo_issues_event_min_datetime": "2021-03-30T09:56:17.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T09:52:23.000Z", "max_forks_repo_path": "ee/app/assets/javascripts/design_management/graphql.js", "max_forks_repo_name": "alwell-kevin/gitlab", "max_forks_repo_forks_event_min_datetime": "2020-11-04T03:39:35.000Z", "max_forks_repo_forks_event_max_datetime": "2020-11-06T04:48:48.000Z"}
{"max_stars_count": null, "max_issues_count": 14, "max_forks_count": 3, "avg_line_length": 30.2413793103, "max_line_length": 95, "alphanum_fraction": 0.6784492588}
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import { uniqueId } from 'lodash';
import { defaultDataIdFromObject } from 'apollo-cache-inmemory';
import createDefaultClient from '~/lib/graphql';

Vue.use(VueApollo);

const defaultClient = createDefaultClient(
  {},
  // This config is added temporarily to resolve an issue with duplicate design IDs.
  // Should be removed as soon as https://gitlab.com/gitlab-org/gitlab/issues/13495 is resolved
  {
    cacheConfig: {
      dataIdFromObject: object => {
        // eslint-disable-next-line no-underscore-dangle, @gitlab/require-i18n-strings
        if (object.__typename === 'Design') {
          return object.id && object.image ? `${object.id}-${object.image}` : uniqueId();
        }
        return defaultDataIdFromObject(object);
      },
    },
  },
);

export default new VueApollo({
  defaultClient,
});
