Commit 3a6b33c7 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Enable `assumeImmutableResults` in requirements Vue app

parent 0e0f4d3c
{"__schema":{"types":[{"kind":"INTERFACE","name":"User","possibleTypes":[{"name":"UserCore"}]}]}}
import { GlToast } from '@gitlab/ui'; import { GlToast } from '@gitlab/ui';
import { defaultDataIdFromObject } from 'apollo-cache-inmemory'; import { defaultDataIdFromObject, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory';
import Vue from 'vue'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql'; import createDefaultClient from '~/lib/graphql';
import { parseBoolean } from '~/lib/utils/common_utils'; import { parseBoolean } from '~/lib/utils/common_utils';
import introspectionQueryResultData from './queries/fragmentTypes.json';
import RequirementsRoot from './components/requirements_root.vue'; import RequirementsRoot from './components/requirements_root.vue';
...@@ -12,6 +13,10 @@ import { FilterState } from './constants'; ...@@ -12,6 +13,10 @@ import { FilterState } from './constants';
Vue.use(VueApollo); Vue.use(VueApollo);
Vue.use(GlToast); Vue.use(GlToast);
const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData,
});
export default () => { export default () => {
const el = document.getElementById('js-requirements-app'); const el = document.getElementById('js-requirements-app');
...@@ -27,7 +32,9 @@ export default () => { ...@@ -27,7 +32,9 @@ export default () => {
dataIdFromObject: (object) => dataIdFromObject: (object) =>
// eslint-disable-next-line no-underscore-dangle, @gitlab/require-i18n-strings // eslint-disable-next-line no-underscore-dangle, @gitlab/require-i18n-strings
object.__typename === 'Requirement' ? object.iid : defaultDataIdFromObject(object), object.__typename === 'Requirement' ? object.iid : defaultDataIdFromObject(object),
fragmentMatcher,
}, },
assumeImmutableResults: true,
}, },
), ),
}); });
......
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