Fixed file templates not clearing in Web IDE
This fixes a bug where the file templates would not be cleared after changing the template type. Previously the templates would get pushed into the array creating a list of templates for the different types. This changes that by clearing the templates array when the template type gets changed. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/52487
This commit is contained in:
parent
05dd7f9718
commit
ff55aa7ebb
3 changed files with 14 additions and 0 deletions
|
@ -13,6 +13,7 @@ export default {
|
|||
},
|
||||
[types.SET_SELECTED_TEMPLATE_TYPE](state, type) {
|
||||
state.selectedTemplateType = type;
|
||||
state.templates = [];
|
||||
},
|
||||
[types.SET_UPDATE_SUCCESS](state, success) {
|
||||
state.updateSuccess = success;
|
||||
|
|
5
changelogs/unreleased/ide-file-templates-clear.yml
Normal file
5
changelogs/unreleased/ide-file-templates-clear.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Clear fetched file templates when changing template type in Web IDE
|
||||
merge_request:
|
||||
author:
|
||||
type: fixed
|
|
@ -49,6 +49,14 @@ describe('IDE file templates mutations', () => {
|
|||
|
||||
expect(state.selectedTemplateType).toBe('type');
|
||||
});
|
||||
|
||||
it('clears templates', () => {
|
||||
state.templates = ['test'];
|
||||
|
||||
mutations[types.SET_SELECTED_TEMPLATE_TYPE](state, 'type');
|
||||
|
||||
expect(state.templates).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe(types.SET_UPDATE_SUCCESS, () => {
|
||||
|
|
Loading…
Reference in a new issue