Commit 94abfa08 authored by Himanshu Kapoor's avatar Himanshu Kapoor

Fix issue with WebIDE not working on empty repos

This commit fixes a regression which prevented WebIDE from working
with empty repositories.
parent 11311bd5
...@@ -83,8 +83,11 @@ export const showBranchNotFoundError = ({ dispatch }, branchId) => { ...@@ -83,8 +83,11 @@ export const showBranchNotFoundError = ({ dispatch }, branchId) => {
}); });
}; };
export const showEmptyState = ({ commit, state }, { projectId, branchId }) => { export const showEmptyState = ({ commit, state, dispatch }, { projectId, branchId }) => {
const treePath = `${projectId}/${branchId}`; const treePath = `${projectId}/${branchId}`;
dispatch('setCurrentBranchId', branchId);
commit(types.CREATE_TREE, { treePath }); commit(types.CREATE_TREE, { treePath });
commit(types.TOGGLE_LOADING, { commit(types.TOGGLE_LOADING, {
entry: state.trees[treePath], entry: state.trees[treePath],
......
---
title: 'Fix: WebIDE doesn''t work on empty repositories again'
merge_request: 22950
author:
type: fixed
...@@ -201,35 +201,30 @@ describe('IDE store project actions', () => { ...@@ -201,35 +201,30 @@ describe('IDE store project actions', () => {
}); });
describe('showEmptyState', () => { describe('showEmptyState', () => {
it('commits proper mutations when supplied error is 404', done => { it('creates a blank tree and sets loading state to false', done => {
testAction( testAction(
showEmptyState, showEmptyState,
{ { projectId: 'abc/def', branchId: 'master' },
err: {
response: {
status: 404,
},
},
projectId: 'abc/def',
branchId: 'master',
},
store.state, store.state,
[ [
{ { type: 'CREATE_TREE', payload: { treePath: 'abc/def/master' } },
type: 'CREATE_TREE',
payload: {
treePath: 'abc/def/master',
},
},
{ {
type: 'TOGGLE_LOADING', type: 'TOGGLE_LOADING',
payload: { payload: { entry: store.state.trees['abc/def/master'], forceValue: false },
entry: store.state.trees['abc/def/master'],
forceValue: false,
},
}, },
], ],
[], jasmine.any(Object),
done,
);
});
it('sets the currentBranchId to the branchId that was passed', done => {
testAction(
showEmptyState,
{ projectId: 'abc/def', branchId: 'master' },
store.state,
jasmine.any(Object),
[{ type: 'setCurrentBranchId', payload: 'master' }],
done, done,
); );
}); });
......
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