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> <script>
import $ from 'jquery'; import $ from 'jquery';
import { GlButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import { produce } from 'immer';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import { deprecatedCreateFlash as createFlash } from '~/flash';
import MergeRequest from '~/merge_request'; import MergeRequest from '~/merge_request';
...@@ -80,12 +81,18 @@ export default { ...@@ -80,12 +81,18 @@ export default {
return; return;
} }
const data = store.readQuery({ const sourceData = store.readQuery({
query: getStateQuery, query: getStateQuery,
variables: mergeRequestQueryVariables, 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({ store.writeQuery({
query: getStateQuery, query: getStateQuery,
data, data,
......
...@@ -10,7 +10,12 @@ Vue.use(Translate); ...@@ -10,7 +10,12 @@ Vue.use(Translate);
Vue.use(VueApollo); Vue.use(VueApollo);
const apolloProvider = new VueApollo({ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(), defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
}); });
export default () => { 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