mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-05-07 15:16:54 +02:00
fix duplicate loading of changesets on first page load
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user