Commit 390e913b authored by Frederic Caplette's avatar Frederic Caplette

Remove writeData from pipeline authoring area

Instead of using writeData to initialize rails
defaults to apollo cache, we now use `writeQuery`
to allow migration to apollo 3.
parent 57b1b32b
......@@ -3,7 +3,8 @@ import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
import { resetServiceWorkersPublicPath } from '../lib/utils/webpack';
import { EDITOR_APP_STATUS_LOADING } from './constants';
import getCommitSha from './graphql/queries/client/commit_sha.graphql';
import getCurrentBranch from './graphql/queries/client/current_branch.graphql';
import { resolvers } from './graphql/resolvers';
import typeDefs from './graphql/typedefs.graphql';
import PipelineEditorApp from './pipeline_editor_app.vue';
......@@ -41,12 +42,19 @@ export const initPipelineEditor = (selector = '#js-pipeline-editor') => {
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(resolvers, { typeDefs }),
});
const { cache } = apolloProvider.clients.defaultClient;
apolloProvider.clients.defaultClient.cache.writeData({
cache.writeQuery({
query: getCurrentBranch,
data: {
currentBranch: initialBranchName || defaultBranch,
},
});
cache.writeQuery({
query: getCommitSha,
data: {
commitSha,
status: EDITOR_APP_STATUS_LOADING,
},
});
......
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