Commit 59dabaa1 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'fc-apollo-local-mutations-refactor-commit-form' into 'master'

Replace calls to writeQuery for client mutations in PA

See merge request gitlab-org/gitlab!73682
parents dd123a4a 389c5db0
......@@ -10,8 +10,8 @@ import {
import commitCIFile from '../../graphql/mutations/commit_ci_file.mutation.graphql';
import updateCurrentBranchMutation from '../../graphql/mutations/update_current_branch.mutation.graphql';
import updateLastCommitBranchMutation from '../../graphql/mutations/update_last_commit_branch.mutation.graphql';
import updatePipelineEtag from '../../graphql/mutations/update_pipeline_etag.mutation.graphql';
import getCurrentBranch from '../../graphql/queries/client/current_branch.graphql';
import getPipelineEtag from '../../graphql/queries/client/pipeline_etag.graphql';
import CommitForm from './commit_form.vue';
......@@ -96,10 +96,10 @@ export default {
content: this.ciFileContent,
lastCommitId: this.commitSha,
},
update(store, { data }) {
update(_, { data }) {
const pipelineEtag = data?.commitCreate?.commit?.commitPipelinePath;
if (pipelineEtag) {
store.writeQuery({ query: getPipelineEtag, data: { pipelineEtag } });
this.$apollo.mutate({ mutation: updatePipelineEtag, variables: pipelineEtag });
}
},
});
......
mutation updatePipelineEtag($pipelineEtag: String) {
updatePipelineEtag(pipelineEtag: $pipelineEtag) @client
}
......@@ -2,6 +2,7 @@ import axios from '~/lib/utils/axios_utils';
import getAppStatus from './queries/client/app_status.graphql';
import getCurrentBranchQuery from './queries/client/current_branch.graphql';
import getLastCommitBranchQuery from './queries/client/last_commit_branch.query.graphql';
import getPipelineEtag from './queries/client/pipeline_etag.graphql';
export const resolvers = {
Mutation: {
......@@ -49,5 +50,11 @@ export const resolvers = {
data: { lastCommitBranch },
});
},
updatePipelineEtag: (_, { pipelineEtag }, { cache }) => {
cache.writeQuery({
query: getPipelineEtag,
data: { pipelineEtag },
});
},
},
};
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