diff options
Diffstat (limited to 'app/assets/javascripts/pipeline_editor/index.js')
-rw-r--r-- | app/assets/javascripts/pipeline_editor/index.js | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/app/assets/javascripts/pipeline_editor/index.js b/app/assets/javascripts/pipeline_editor/index.js index 583ba555080..dc427f55b5f 100644 --- a/app/assets/javascripts/pipeline_editor/index.js +++ b/app/assets/javascripts/pipeline_editor/index.js @@ -2,12 +2,17 @@ import Vue from 'vue'; import VueApollo from 'vue-apollo'; import createDefaultClient from '~/lib/graphql'; -import typeDefs from './graphql/typedefs.graphql'; +import { resetServiceWorkersPublicPath } from '../lib/utils/webpack'; import { resolvers } from './graphql/resolvers'; - +import typeDefs from './graphql/typedefs.graphql'; import PipelineEditorApp from './pipeline_editor_app.vue'; export const initPipelineEditor = (selector = '#js-pipeline-editor') => { + // Prevent issues loading syntax validation workers + // Fixes https://gitlab.com/gitlab-org/gitlab/-/issues/297252 + // TODO Remove when https://gitlab.com/gitlab-org/gitlab/-/issues/321656 is resolved + resetServiceWorkersPublicPath(); + const el = document.querySelector(selector); if (!el) { @@ -15,14 +20,13 @@ export const initPipelineEditor = (selector = '#js-pipeline-editor') => { } const { - // props - ciConfigPath, + // Add to apollo cache as it can be updated by future queries commitSha, + // Add to provide/inject API for static values + ciConfigPath, defaultBranch, - newMergeRequestPath, - - // `provide/inject` data lintHelpPagePath, + newMergeRequestPath, projectFullPath, projectPath, projectNamespace, @@ -35,25 +39,27 @@ export const initPipelineEditor = (selector = '#js-pipeline-editor') => { defaultClient: createDefaultClient(resolvers, { typeDefs }), }); + apolloProvider.clients.defaultClient.cache.writeData({ + data: { + commitSha, + }, + }); + return new Vue({ el, apolloProvider, provide: { + ciConfigPath, + defaultBranch, lintHelpPagePath, + newMergeRequestPath, projectFullPath, projectPath, projectNamespace, ymlHelpPagePath, }, render(h) { - return h(PipelineEditorApp, { - props: { - ciConfigPath, - commitSha, - defaultBranch, - newMergeRequestPath, - }, - }); + return h(PipelineEditorApp); }, }); }; |