Commit d021195a authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '30881-webide-mr-confirmation' into 'master'

Resolve "WebIDE asks for confirmation to leave the page when committing and creating a new MR"

Closes #30881

See merge request gitlab-org/gitlab!17671
parents b9cba28e 95bacb06
......@@ -152,6 +152,14 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo
branch: getters.branchName,
})
.then(() => {
commit(rootTypes.CLEAR_STAGED_CHANGES, null, { root: true });
commit(rootTypes.CLEAR_REPLACED_FILES, null, { root: true });
setTimeout(() => {
commit(rootTypes.SET_LAST_COMMIT_MSG, '', { root: true });
}, 5000);
if (state.shouldCreateMR) {
const { currentProject } = rootGetters;
const targetBranch = getters.isCreatingNewBranch
......@@ -164,14 +172,6 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo
{ root: true },
);
}
commit(rootTypes.CLEAR_STAGED_CHANGES, null, { root: true });
commit(rootTypes.CLEAR_REPLACED_FILES, null, { root: true });
setTimeout(() => {
commit(rootTypes.SET_LAST_COMMIT_MSG, '', { root: true });
}, 5000);
})
.then(() => {
if (rootGetters.lastOpenedFile) {
......
---
title: 'Fix Issue: WebIDE asks for confirmation to leave the page when committing
and creating a new MR'
merge_request: 17671
author:
type: fixed
......@@ -473,18 +473,16 @@ describe('IDE commit module actions', () => {
});
it('resets changed files before redirecting', done => {
visitUrl = visitUrl.and.callFake(() => {
expect(store.state.stagedFiles.length).toBe(0);
done();
});
spyOn(eventHub, '$on');
store.state.commit.commitAction = '3';
store
.dispatch('commit/commitChanges')
.then(() => {
expect(store.state.stagedFiles.length).toBe(0);
done();
})
.catch(done.fail);
store.dispatch('commit/commitChanges').catch(done.fail);
});
});
});
......
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