Commit c6f9101f authored by Natalia Tepluhina's avatar Natalia Tepluhina

Set assumeImmutableResults to true


- Fixed all the occurences of 'createDefaultClient'
- Updated FE guide on Apollo immutability
parent 1972ec41
......@@ -49,7 +49,7 @@ export const initProjectsField = () => {
{ default: createDefaultClient },
]) => {
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
Vue.use(VueApollo);
......
......@@ -15,7 +15,7 @@ import {
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
const initApp = (el, component, userPropKey, props = {}) => {
......
......@@ -38,7 +38,6 @@ export default () => {
return defaultDataIdFromObject(object);
},
},
assumeImmutableResults: true,
},
),
});
......
......@@ -59,6 +59,5 @@ export default new VueApollo({
cacheConfig: {
fragmentMatcher,
},
assumeImmutableResults: true,
}),
});
......@@ -6,7 +6,7 @@ import UsageTrendsApp from './components/app.vue';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
export default () => {
......
......@@ -6,7 +6,7 @@ import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
export default (containerId = 'js-artifacts-settings-app') => {
......
......@@ -17,6 +17,5 @@ export const gqlClient = createDefaultClient(
fragmentMatcher,
},
assumeImmutableResults: true,
},
);
......@@ -8,12 +8,7 @@ import { parseBoolean } from '~/lib/utils/common_utils';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
export default (params = {}) => {
......
......@@ -8,9 +8,7 @@ import CiLint from './components/ci_lint.vue';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(resolvers, {
assumeImmutableResults: true,
}),
defaultClient: createDefaultClient(resolvers),
});
export default (containerId = '#js-ci-lint') => {
......
......@@ -12,12 +12,7 @@ export default () => {
return null;
}
const defaultClient = createDefaultClient(
{},
{
assumeImmutableResults: true,
},
);
const defaultClient = createDefaultClient();
const { agentName, projectPath } = el.dataset;
return new Vue({
......
......@@ -8,7 +8,7 @@ export default (Vue, VueApollo) => {
return null;
}
const defaultClient = createDefaultClient({}, { assumeImmutableResults: true });
const defaultClient = createDefaultClient();
const {
emptyStateImage,
......
......@@ -88,7 +88,6 @@ const defaultClient = createDefaultClient(
fragmentMatcher,
},
typeDefs,
assumeImmutableResults: true,
},
);
......
......@@ -8,7 +8,7 @@ Vue.use(Translate);
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
export default () => {
......
......@@ -2,16 +2,12 @@ import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
import environmentApp from './queries/environmentApp.query.graphql';
import { resolvers } from './resolvers';
import typedefs from './typedefs.graphql';
import typeDefs from './typedefs.graphql';
export const apolloProvider = (endpoint) => {
const defaultClient = createDefaultClient(
resolvers(endpoint),
{
assumeImmutableResults: true,
},
typedefs,
);
const defaultClient = createDefaultClient(resolvers(endpoint), {
typeDefs,
});
const { cache } = defaultClient;
cache.writeQuery({
......
......@@ -9,7 +9,7 @@ Vue.use(Translate);
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
export default (el) => {
......
......@@ -20,12 +20,7 @@ export default () => {
} = domEl.dataset;
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
// eslint-disable-next-line no-new
......
......@@ -376,8 +376,4 @@ export function createResolvers({ endpoints, sourceUrl, GroupsManager = SourceGr
}
export const createApolloClient = ({ sourceUrl, endpoints }) =>
createDefaultClient(
createResolvers({ sourceUrl, endpoints }),
{ assumeImmutableResults: true },
typeDefs,
);
createDefaultClient(createResolvers({ sourceUrl, endpoints }), { typeDefs });
......@@ -24,7 +24,7 @@ export default () => {
} = domEl.dataset;
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
return new Vue({
......
......@@ -10,12 +10,7 @@ export default function initIssuableSuggestions() {
const issueTitle = document.getElementById('issue_title');
const { projectPath } = el.dataset;
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
return new Vue({
......
......@@ -24,7 +24,7 @@ export function mountJiraIssuesListApp() {
}
Vue.use(VueApollo);
const defaultClient = createDefaultClient({}, { assumeImmutableResults: true });
const defaultClient = createDefaultClient();
const apolloProvider = new VueApollo({
defaultClient,
});
......@@ -103,7 +103,7 @@ export function mountIssuesListApp() {
},
};
const defaultClient = createDefaultClient(resolvers, { assumeImmutableResults: true });
const defaultClient = createDefaultClient(resolvers);
const apolloProvider = new VueApollo({
defaultClient,
});
......
......@@ -14,12 +14,7 @@ export default async function initJiraConnectBranches() {
const { initialBranchName, successStateSvgPath } = el.dataset;
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
return new Vue({
......
......@@ -6,7 +6,7 @@ import App from './components/jira_import_app.vue';
Vue.use(VueApollo);
const defaultClient = createDefaultClient({}, { assumeImmutableResults: true });
const defaultClient = createDefaultClient();
const apolloProvider = new VueApollo({
defaultClient,
......
......@@ -9,12 +9,7 @@ Vue.use(VueApollo);
Vue.use(GlToast);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
export default (containerId = 'js-jobs-table') => {
......
......@@ -48,7 +48,6 @@ export const stripWhitespaceFromQuery = (url, path) => {
export default (resolvers = {}, config = {}) => {
const {
assumeImmutableResults,
baseUrl,
batchMax = 10,
cacheConfig,
......@@ -161,10 +160,10 @@ export default (resolvers = {}, config = {}) => {
link: appLink,
cache: new InMemoryCache({
...cacheConfig,
freezeResults: assumeImmutableResults,
freezeResults: true,
}),
resolvers,
assumeImmutableResults,
assumeImmutableResults: true,
defaultOptions: {
query: {
fetchPolicy,
......
......@@ -48,12 +48,7 @@ export default (elements) => {
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
const listenerAddedAttr = 'data-mr-listener-added';
......
......@@ -5,10 +5,5 @@ import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
export const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
......@@ -17,7 +17,6 @@ export const apolloProvider = new VueApollo({
cacheConfig: {
fragmentMatcher,
},
assumeImmutableResults: true,
},
),
});
......@@ -5,10 +5,5 @@ import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
export const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
......@@ -5,10 +5,5 @@ import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
export const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
......@@ -14,7 +14,7 @@ import '~/sourcegraph/load';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
const viewBlobEl = document.querySelector('#js-view-blob-app');
......
......@@ -28,7 +28,7 @@ export default function initMergeRequestShow() {
const el = document.querySelector('.js-mr-status-box');
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
// eslint-disable-next-line no-new
new Vue({
......
......@@ -9,12 +9,7 @@ export function initInstallRunner(componentId = 'js-install-runner') {
const installRunnerEl = document.getElementById(componentId);
if (installRunnerEl) {
const defaultClient = createDefaultClient(
{},
{
assumeImmutableResults: true,
},
);
const defaultClient = createDefaultClient();
const apolloProvider = new VueApollo({
defaultClient,
......
......@@ -61,7 +61,6 @@ export const initPipelineEditor = (selector = '#js-pipeline-editor') => {
defaultClient: createDefaultClient(resolvers, {
typeDefs,
useGet: true,
assumeImmutableResults: true,
}),
});
const { cache } = apolloProvider.clients.defaultClient;
......
......@@ -5,7 +5,6 @@ export const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
useGet: true,
},
),
......
......@@ -5,12 +5,7 @@ import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
export const initCommitPipelineMiniGraph = async (selector = '.js-commit-pipeline-mini-graph') => {
......
......@@ -50,7 +50,7 @@ export function initNewProjectUrlSelect() {
new Vue({
el,
apolloProvider: new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
}),
provide: {
namespaceFullPath: el.dataset.namespaceFullPath,
......
......@@ -7,7 +7,7 @@ import ProjectPipelinesCharts from './components/app.vue';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
const mountPipelineChartsApp = (el) => {
......
......@@ -25,7 +25,7 @@ export default (containerId = 'js-project-storage-count-app') => {
} = el.dataset;
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
return new Vue({
......
......@@ -6,7 +6,7 @@ import TerraformNotification from './components/terraform_notification.vue';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmtableResults: true }),
defaultClient: createDefaultClient(),
});
export default () => {
......
......@@ -9,7 +9,6 @@ export const apolloProvider = new VueApollo({
{},
{
batchMax: 1,
assumeImmutableResults: true,
},
),
});
......@@ -24,7 +24,6 @@ export default () => {
// the purpose of making separate requests. So we explicitly
// disable batching on this page.
batchMax: 1,
assumeImmutableResults: true,
},
),
});
......
......@@ -6,12 +6,7 @@ import ReleaseShowApp from './components/app_show.vue';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
export default () => {
......
......@@ -64,7 +64,6 @@ const defaultClient = createDefaultClient(
/* eslint-enable @gitlab/require-i18n-strings */
},
},
assumeImmutableResults: true,
},
);
......
......@@ -19,12 +19,7 @@ export const initAdminRunners = (selector = '#js-admin-runners') => {
const { activeRunnersCount, registrationToken, runnerInstallHelpPage } = el.dataset;
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
return new Vue({
......
......@@ -23,12 +23,7 @@ export const initGroupRunners = (selector = '#js-group-runners') => {
} = el.dataset;
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
return new Vue({
......
......@@ -15,12 +15,7 @@ export const initRunnerDetail = (selector = '#js-runner-details') => {
const { runnerId } = el.dataset;
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
return new Vue({
......
......@@ -14,7 +14,7 @@ export const initSecurityConfiguration = (el) => {
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
const {
......
......@@ -25,7 +25,6 @@ export const defaultClient = createDefaultClient(resolvers, {
cacheConfig: {
fragmentMatcher,
},
assumeImmutableResults: true,
});
export const apolloProvider = new VueApollo({
......
......@@ -18,7 +18,6 @@ export default function appFactory(el, Component) {
{},
{
batchMax: 1,
assumeImmutableResults: true,
},
),
});
......
......@@ -22,7 +22,6 @@ const createApolloProvider = (appData) => {
},
{
typeDefs,
assumeImmutableResults: true,
},
);
......
......@@ -22,7 +22,6 @@ export default () => {
return object.id || defaultDataIdFromObject(object);
},
},
assumeImmutableResults: true,
});
const { emptyStateImage, projectPath, accessTokensPath, terraformApiUrl, username } = el.dataset;
......
......@@ -6,7 +6,7 @@ import TokenAccess from './components/token_access.vue';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
export const initTokenAccess = (containerId = 'js-ci-token-access-app') => {
......
......@@ -13,12 +13,7 @@ Vue.use(Translate);
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
export default () => {
......
......@@ -38,7 +38,6 @@ export default (selector) => {
return defaultDataIdFromObject(object);
},
},
assumeImmutableResults: true,
}),
});
......
......@@ -5,5 +5,5 @@ import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
export default new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
......@@ -4,6 +4,7 @@ import { IntrospectionFragmentMatcher } from 'apollo-cache-inmemory';
import createDefaultClient from '~/lib/graphql';
import workItemQuery from './work_item.query.graphql';
import introspectionQueryResultData from './fragmentTypes.json';
import typeDefs from './typedefs.graphql';
const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData,
......@@ -18,7 +19,7 @@ export function createApolloProvider() {
cacheConfig: {
fragmentMatcher,
},
assumeImmutableResults: true,
typeDefs,
},
);
......
......@@ -103,7 +103,6 @@ Default client accepts two parameters: `resolvers` and `config`.
- `config` parameter takes an object of configuration settings:
- `cacheConfig` field accepts an optional object of settings to [customize Apollo cache](https://www.apollographql.com/docs/react/caching/cache-configuration/#configuring-the-cache)
- `baseUrl` allows us to pass a URL for GraphQL endpoint different from our main endpoint (for example, `${gon.relative_url_root}/api/graphql`)
- `assumeImmutableResults` (set to `false` by default) - this setting, when set to `true`, assumes that every single operation on updating Apollo Cache is immutable. It also sets `freezeResults` to `true`, so any attempt on mutating Apollo Cache throws a console warning in development environment. Please ensure you're following the immutability pattern on cache update operations before setting this option to `true`.
- `fetchPolicy` determines how you want your component to interact with the Apollo cache. Defaults to "cache-first".
### Multiple client queries for the same object
......@@ -179,7 +178,7 @@ with a **new and updated** object.
To facilitate the process of updating the cache and returning the new object we
use the library [Immer](https://immerjs.github.io/immer/).
When possible, follow these conventions:
Please, follow these conventions:
- The updated cache is named `data`.
- The original cache data is named `sourceData`.
......@@ -204,11 +203,6 @@ client.writeQuery({
As shown in the code example by using `produce`, we can perform any kind of direct manipulation of the
`draftState`. Besides, `immer` guarantees that a new state which includes the changes to `draftState` is generated.
Finally, to verify whether the immutable cache update is working properly, we need to change
`assumeImmutableResults` to `true` in the default client configuration. See [Apollo Client](#apollo-client) for more information.
If everything is working properly `assumeImmutableResults` should remain set to `true`.
## Usage in Vue
To use Vue Apollo, import the [Vue Apollo](https://github.com/vuejs/vue-apollo) plugin as well
......
......@@ -8,12 +8,7 @@ import CloudLicenseShowApp from './components/app.vue';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
export default () => {
......
......@@ -14,12 +14,7 @@ Vue.use(GlToast);
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
export default () => {
......
......@@ -34,5 +34,5 @@ export const createResolvers = (groupId) => ({
export const createApolloProvider = (groupId) =>
new VueApollo({
defaultClient: createDefaultClient(createResolvers(groupId), { assumeImmutableResults: true }),
defaultClient: createDefaultClient(createResolvers(groupId)),
});
......@@ -7,7 +7,7 @@ import CiCdAnalyticsApp from './components/app.vue';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
export default () => {
......
......@@ -11,7 +11,7 @@ import { parseAndValidateDates } from './utils';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
export default () => {
......
......@@ -15,7 +15,7 @@ import { getLabelsEndpoint, getMilestonesEndpoint } from './utils';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
export default () => {
......
......@@ -6,7 +6,7 @@ import GroupRepositoryAnalytics from './components/group_repository_analytics.vu
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
export default () => {
......
......@@ -9,7 +9,7 @@ import BurnCharts from './components/burn_charts.vue';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
export default () => {
......
......@@ -7,7 +7,7 @@ import CiMinutesUsageApp from './components/app.vue';
const mountCiMinutesUsageApp = (el) => {
Vue.use(VueApollo);
const defaultClient = createDefaultClient({}, { assumeImmutableResults: true });
const defaultClient = createDefaultClient();
const apolloProvider = new VueApollo({
defaultClient,
});
......
......@@ -6,12 +6,7 @@ import EpicForm from './components/epic_form.vue';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
export function initEpicForm() {
......
......@@ -32,7 +32,6 @@ const apolloProvider = new VueApollo({
cacheConfig: {
fragmentMatcher,
},
assumeImmutableResults: true,
},
),
});
......
......@@ -18,12 +18,7 @@ export default function initEpicsList({ mountPointSelector }) {
}
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
const {
......
......@@ -19,7 +19,6 @@ const apolloProvider = new VueApollo({
return defaultDataIdFromObject(object);
},
},
assumeImmutableResults: true,
},
),
});
......
......@@ -11,7 +11,7 @@ export default (externalIssuesQueryResolver) => {
},
};
const defaultClient = createDefaultClient(resolvers, { assumeImmutableResults: true });
const defaultClient = createDefaultClient(resolvers);
return new VueApollo({
defaultClient,
......
......@@ -9,7 +9,7 @@ import EditForm from './components/edit_form.vue';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
const createComplianceFrameworksFormApp = (el) => {
......
......@@ -7,7 +7,7 @@ import Form from './components/list.vue';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
const createComplianceFrameworksListApp = (el) => {
......
......@@ -19,7 +19,6 @@ const apolloProvider = new VueApollo({
{},
{
batchMax: 1,
assumeImmutableResults: true,
},
),
});
......
......@@ -4,12 +4,7 @@ import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
const defaultClient = createDefaultClient(
{},
{
assumeImmutableResults: true,
},
);
const defaultClient = createDefaultClient();
export default new VueApollo({
defaultClient,
......
......@@ -5,5 +5,5 @@ import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
export default new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
......@@ -19,8 +19,5 @@ const resolvers = {
};
export default new VueApollo({
defaultClient: createDefaultClient(resolvers, {
cacheConfig: {},
assumeImmutableResults: true,
}),
defaultClient: createDefaultClient(resolvers),
});
......@@ -47,7 +47,7 @@ const fetchMergeOptions = () => {
const containerEl = document.querySelector('#project-merge-options');
const { projectFullPath } = containerEl.dataset;
const defaultClient = createDefaultClient({}, { assumeImmutableResults: true });
const defaultClient = createDefaultClient();
return defaultClient
.query({
......
......@@ -34,7 +34,6 @@ export default () => {
object.__typename === 'Requirement' ? object.iid : defaultDataIdFromObject(object),
fragmentMatcher,
},
assumeImmutableResults: true,
},
),
});
......
......@@ -30,7 +30,7 @@ export default () => {
}
Vue.use(VueApollo);
const defaultClient = createDefaultClient({}, { assumeImmutableResults: true });
const defaultClient = createDefaultClient();
const apolloProvider = new VueApollo({
defaultClient,
});
......
......@@ -5,10 +5,5 @@ import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
export const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
defaultClient: createDefaultClient(),
});
......@@ -15,7 +15,6 @@ export default () => {
}
const defaultClient = createDefaultClient(resolvers, {
assumeImmutableResults: true,
cacheConfig: {
dataIdFromObject: (object) => {
return object.id || defaultDataIdFromObject(object);
......
......@@ -13,7 +13,7 @@ export default function init() {
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
const {
......
......@@ -5,5 +5,5 @@ import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
export default new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
......@@ -5,5 +5,5 @@ import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
export default new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
......@@ -5,5 +5,5 @@ import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
export default new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
......@@ -5,5 +5,5 @@ import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
export default new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
......@@ -13,7 +13,7 @@ export default function init() {
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
const {
......
......@@ -18,7 +18,6 @@ const defaultClient = createDefaultClient(
cacheConfig: {
fragmentMatcher,
},
assumeImmutableResults: true,
},
);
......
......@@ -15,7 +15,7 @@ export default () => {
} = el.dataset;
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
return new Vue({
......
......@@ -11,14 +11,13 @@ Vue.use(VueApollo);
const gitlabClient = createClient(merge({}, resolvers, purchaseFlowResolvers), {
typeDefs,
assumeImmutableResults: true,
});
const customersDotClient = createClient(
{},
{
path: '/-/customers_dot/proxy/graphql',
useGet: true,
assumeImmutableResults: true,
},
);
......
......@@ -8,7 +8,6 @@ import { STEPS } from '../constants';
function createClient(stepList) {
const client = createDefaultClient(resolvers, {
typeDefs,
assumeImmutableResults: true,
});
client.cache.writeQuery({
......
......@@ -15,7 +15,7 @@ export function initTestCaseCreate({ mountPointSelector }) {
}
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
return new Vue({
......
......@@ -19,7 +19,7 @@ const initTestCaseList = ({ mountPointSelector }) => {
}
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
const {
......
......@@ -16,7 +16,7 @@ export default function initTestCaseShow({ mountPointSelector }) {
}
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
const sidebarOptions = JSON.parse(el.dataset.sidebarOptions);
......
......@@ -12,7 +12,6 @@ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
cacheConfig: {
dataIdFromObject: (object) => {
// eslint-disable-next-line no-underscore-dangle
......
......@@ -9,7 +9,7 @@ import createStore from './store';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
export default () => {
......
......@@ -50,9 +50,4 @@ export const removeUnnecessaryDashes = (manifest) => {
/**
* Create GraphQL Client for threat monitoring
*/
export const gqClient = createGqClient(
{},
{
assumeImmutableResults: true,
},
);
export const gqClient = createGqClient();
......@@ -15,7 +15,7 @@ export default function initIterationsDropdownBundle() {
}
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
defaultClient: createDefaultClient(),
});
const { fullPath } = el.dataset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment