Commit ff55aa7e authored by Phil Hughes's avatar Phil Hughes

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
parent 05dd7f97
......@@ -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;
......
---
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, () => {
......
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