Commit 167c9b70 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '322724-fix-compare-page-dropdown-loading' into 'master'

Fix issue with loading tags on the compare page

See merge request gitlab-org/gitlab!55058
parents 2b310699 90d10172
......@@ -65,8 +65,8 @@ export default {
return axios
.get(endpoint)
.then(({ data }) => {
this.branches = data.Branches;
this.tags = data.Tags;
this.branches = data.Branches || [];
this.tags = data.Tags || [];
})
.catch(() => {
createFlash({
......
---
title: Fix issue with loading the repository compare page
merge_request: 55058
author:
type: fixed
......@@ -62,6 +62,20 @@ describe('RevisionDropdown component', () => {
expect(wrapper.vm.tags).toEqual(Tags);
});
it('sets branches and tags to be an empty array when no tags or branches are given', async () => {
axiosMock.onGet(defaultProps.refsProjectPath).replyOnce(200, {
Branches: undefined,
Tags: undefined,
});
createComponent();
await axios.waitForAll();
expect(wrapper.vm.branches).toEqual([]);
expect(wrapper.vm.tags).toEqual([]);
});
it('shows flash message on error', async () => {
axiosMock.onGet('some/invalid/path').replyOnce(404);
......
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