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) => {
});
};
export const showEmptyState = ({ commit, state }, { projectId, branchId }) => {
export const showEmptyState = ({ commit, state, dispatch }, { projectId, branchId }) => {
const treePath = `${projectId}/${branchId}`;
dispatch('setCurrentBranchId', branchId);
commit(types.CREATE_TREE, { treePath });
commit(types.TOGGLE_LOADING, {
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', () => {
});
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(
showEmptyState,
{
err: {
response: {
status: 404,
},
},
projectId: 'abc/def',
branchId: 'master',
},
{ projectId: 'abc/def', branchId: 'master' },
store.state,
[
{
type: 'CREATE_TREE',
payload: {
treePath: 'abc/def/master',
},
},
{ type: 'CREATE_TREE', payload: { treePath: 'abc/def/master' } },
{
type: 'TOGGLE_LOADING',
payload: {
entry: store.state.trees['abc/def/master'],
forceValue: false,
},
payload: { 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,
);
});
......
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