Skip to content

Commit 8928fe3

Browse files
committed
Update live-view.js
1 parent 3699514 commit 8928fe3

File tree

1 file changed

+30
-28
lines changed

1 file changed

+30
-28
lines changed

live-view/live-view.js

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,41 @@ async function setupLiveView() {
1212
// get repo obj from local storage
1313
const repoObj = modifiedRepos[linkData.dir[0] + '/' + linkData.dir[1].split(':')[0]];
1414

15+
16+
// if selected branch does not exist
17+
if (!selBranch) {
18+
19+
// get default branch
20+
21+
let defaultBranch;
22+
23+
if (repoObj && repoObj.defaultBranch) {
24+
25+
defaultBranch = repoObj.defaultBranch;
26+
27+
} else {
28+
29+
defaultBranch = (await git.getRepo(treeLoc)).default_branch;
30+
31+
}
32+
33+
// add branch to tree
34+
treeLoc[1] = linkData.dir[1].split(':')[0] + ':' + defaultBranch;
35+
saveTreeLocLS(treeLoc);
36+
37+
// set selected branch to default branch
38+
selBranch = defaultBranch;
39+
40+
}
41+
42+
1543
// if repo obj exists
16-
if (repoObj &&
44+
if (repoObj &&
1745
repoObj.selBranch !== selBranch) {
1846

19-
// if selected branch does not exist
20-
if (!selBranch) {
21-
22-
// get default branch
23-
24-
let defaultBranch;
25-
26-
if (repoObj.defaultBranch) {
27-
28-
defaultBranch = repoObj.defaultBranch;
29-
30-
} else {
31-
32-
defaultBranch = (await git.getRepo(treeLoc)).default_branch;
33-
34-
}
35-
36-
// add branch to tree
37-
treeLoc[1] = linkData.dir[1].split(':')[0] + ':' + defaultBranch;
38-
saveTreeLocLS(treeLoc);
39-
40-
// set selected branch to default branch
41-
selBranch = defaultBranch;
42-
43-
}
44-
4547
// update selected branch in local storage
4648
updateModRepoSelectedBranch((treeLoc[0] + '/' + treeLoc[1].split(':')[0]), selBranch);
47-
49+
4850
}
4951

5052

0 commit comments

Comments
 (0)