Commit 25de286a authored by Phil Hughes's avatar Phil Hughes

Merge branch 'nmezzopera-immutable-cache-update-mr-widget' into 'master'

Refactor mr-widget-wip  removeWipMutation to immer

See merge request gitlab-org/gitlab!47302
parents 074ba98b 51955c3e
<script>
import $ from 'jquery';
import { GlButton } from '@gitlab/ui';
import { produce } from 'immer';
import { __ } from '~/locale';
import { deprecatedCreateFlash as createFlash } from '~/flash';
import MergeRequest from '~/merge_request';
......@@ -80,12 +81,18 @@ export default {
return;
}
const data = store.readQuery({
const sourceData = store.readQuery({
query: getStateQuery,
variables: mergeRequestQueryVariables,
});
data.project.mergeRequest.workInProgress = workInProgress;
data.project.mergeRequest.title = title;
const data = produce(sourceData, draftState => {
// eslint-disable-next-line no-param-reassign
draftState.project.mergeRequest.workInProgress = workInProgress;
// eslint-disable-next-line no-param-reassign
draftState.project.mergeRequest.title = title;
});
store.writeQuery({
query: getStateQuery,
data,
......
......@@ -10,7 +10,12 @@ Vue.use(Translate);
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(),
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
});
export default () => {
......
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