Commit 56e33f47 authored by Frederic Caplette's avatar Frederic Caplette

Fix CI editor template not updating on commit

When the default content is loaded for the pipeline
editor, there was an issue where changing the content
of the file would not be saved when you commit. This
was due to using a computed prop to store the content:
if it was a new file, we were using the template,
and if not, we were using the normal content.
However when the user starts typing, it is
still a new Ci config file, so the content
was never properlyupdated in hte global store.

Changelog: fixed
parent 2815df83
......@@ -152,6 +152,9 @@ export default {
update(data) {
return data.project?.ciTemplate?.content || '';
},
result({ data }) {
this.updateCiConfig(data.project?.ciTemplate?.content || '');
},
error() {
this.reportFailure(LOAD_FAILURE_UNKNOWN);
},
......@@ -170,9 +173,6 @@ export default {
isEmpty() {
return this.currentCiFileContent === '';
},
templateOrCurrentContent() {
return this.isNewCiConfigFile ? this.starterTemplate : this.currentCiFileContent;
},
},
i18n: {
tabEdit: s__('Pipelines|Edit'),
......@@ -280,7 +280,7 @@ export default {
/>
<pipeline-editor-home
:ci-config-data="ciConfigData"
:ci-file-content="templateOrCurrentContent"
:ci-file-content="currentCiFileContent"
:is-new-ci-config-file="isNewCiConfigFile"
@commit="updateOnCommit"
@resetContent="resetContent"
......
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