fix duplicate loading of changesets on first page load

This commit is contained in:
Sebastian Sdorra
2018-10-17 15:18:42 +02:00
parent 1a07827fb6
commit 959f9d81da
2 changed files with 6 additions and 3 deletions

View File

@@ -97,14 +97,12 @@ function extractBranchesFromPayload(payload: any) {
// Selectors
const empty = [];
export function getBranches(state: Object, repository: Repository) {
const key = createKey(repository);
if (state.branches[key]) {
return state.branches[key];
}
return empty;
return null;
}
export function getBranch(

View File

@@ -157,6 +157,11 @@ describe("branches", () => {
expect(one).toBe(two);
});
it("should return null, if no branches for the repository available", () => {
const branches = getBranches({ branches: {} }, repository);
expect(branches).toBeNull();
});
it("should return single branch by name", () => {
const branch = getBranch(state, repository, "branch1");
expect(branch).toEqual(branch1);