Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 6a97608

Browse files
Creating Tree instance at the right times
1 parent 1b17338 commit 6a97608

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ChangesView.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ChangesView : Subview
2828
[SerializeField] private Vector2 scroll;
2929
[SerializeField] private CacheUpdateEvent lastCurrentBranchChangedEvent;
3030
[SerializeField] private CacheUpdateEvent lastStatusChangedEvent;
31-
[SerializeField] private Tree treeChanges = new Tree();
31+
[SerializeField] private Tree treeChanges;
3232
[SerializeField] private List<GitStatusEntry> gitStatusEntries;
3333

3434
public override void OnEnable()
@@ -188,10 +188,13 @@ private void MaybeUpdateData()
188188

189189
private void BuildTree()
190190
{
191-
treeChanges = new Tree();
192-
treeChanges.ActiveNodeIcon = Styles.ActiveBranchIcon;
193-
treeChanges.NodeIcon = Styles.BranchIcon;
194-
treeChanges.FolderIcon = Styles.FolderIcon;
191+
if (treeChanges == null)
192+
{
193+
treeChanges = new Tree();
194+
treeChanges.ActiveNodeIcon = Styles.ActiveBranchIcon;
195+
treeChanges.NodeIcon = Styles.BranchIcon;
196+
treeChanges.FolderIcon = Styles.FolderIcon;
197+
}
195198

196199
treeChanges.Load(gitStatusEntries.Select(entry => new GitStatusEntryTreeData(entry)).Cast<ITreeData>(), "Changes");
197200
Redraw();

0 commit comments

Comments
 (0)