Commit 51955c3e authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera Committed by Phil Hughes

Refactor mr-widget-wip removeWipMutation to immer

parent 533b95f9
<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