Commit 20bdc02e authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '227382-security-dashboard-assume-immutability' into 'master'

Set `assumeImmutableResults` in security dashboard

See merge request gitlab-org/gitlab!42505
parents b39b8929 6f8463e4
<script>
import produce from 'immer';
import { GlAlert, GlButton, GlIntersectionObserver } from '@gitlab/ui';
import VulnerabilityList from './vulnerability_list.vue';
import vulnerabilitiesQuery from '../graphql/group_vulnerabilities.graphql';
......@@ -72,10 +73,14 @@ export default {
this.$apollo.queries.vulnerabilities.fetchMore({
variables: { after: this.pageInfo.endCursor },
updateQuery: (previousResult, { fetchMoreResult }) => {
fetchMoreResult.group.vulnerabilities.nodes.unshift(
const results = produce(fetchMoreResult, draftData => {
// eslint-disable-next-line no-param-reassign
draftData.group.vulnerabilities.nodes = [
...previousResult.group.vulnerabilities.nodes,
);
return fetchMoreResult;
...draftData.group.vulnerabilities.nodes,
];
});
return results;
},
});
}
......
<script>
import produce from 'immer';
import { GlAlert, GlButton, GlIntersectionObserver, GlLoadingIcon } from '@gitlab/ui';
import { fetchPolicies } from '~/lib/graphql';
import VulnerabilityList from './vulnerability_list.vue';
......@@ -69,8 +70,14 @@ export default {
this.$apollo.queries.vulnerabilities.fetchMore({
variables: { after: this.pageInfo.endCursor },
updateQuery: (previousResult, { fetchMoreResult }) => {
fetchMoreResult.vulnerabilities.nodes.unshift(...previousResult.vulnerabilities.nodes);
return fetchMoreResult;
const results = produce(fetchMoreResult, draftData => {
// eslint-disable-next-line no-param-reassign
draftData.vulnerabilities.nodes = [
...previousResult.vulnerabilities.nodes,
...draftData.vulnerabilities.nodes,
];
});
return results;
},
});
}
......
<script>
import produce from 'immer';
import { GlAlert, GlButton, GlIntersectionObserver } from '@gitlab/ui';
import { __ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
......@@ -99,12 +100,14 @@ export default {
this.$apollo.queries.vulnerabilities.fetchMore({
variables: { after: this.pageInfo.endCursor },
updateQuery: (previousResult, { fetchMoreResult }) => {
const newResult = { ...fetchMoreResult };
previousResult.project.vulnerabilities.nodes.push(
...fetchMoreResult.project.vulnerabilities.nodes,
);
newResult.project.vulnerabilities.nodes = previousResult.project.vulnerabilities.nodes;
return newResult;
const results = produce(fetchMoreResult, draftData => {
// eslint-disable-next-line no-param-reassign
draftData.project.vulnerabilities.nodes = [
...previousResult.project.vulnerabilities.nodes,
...draftData.project.vulnerabilities.nodes,
];
});
return results;
},
});
}
......
......@@ -18,6 +18,7 @@ const defaultClient = createDefaultClient(
cacheConfig: {
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