Skip to content

Commit 315138b

Browse files
committed
Initialize branches, currentBranch and repository from model in GitPanel constructor
1 parent 395d343 commit 315138b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/GitPanel.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,16 @@ export class GitPanel extends React.Component<IGitPanelProps, IGitPanelState> {
114114
*/
115115
constructor(props: IGitPanelProps) {
116116
super(props);
117+
const { branches, currentBranch, pathRepository } = props.model;
117118

118119
this.state = {
119-
branches: [],
120-
currentBranch: '',
120+
branches: branches,
121+
currentBranch: currentBranch ? currentBranch.name : 'master',
121122
files: [],
122123
nCommitsAhead: 0,
123124
nCommitsBehind: 0,
124125
pastCommits: [],
125-
repository: props.model.pathRepository,
126+
repository: pathRepository,
126127
tab: 0
127128
};
128129
}

0 commit comments

Comments
 (0)