Skip to content

Commit 42db2b1

Browse files
authored
fix: sometimes no staged/unstaged changes were shown (#2030)
Due to a race condition it was possible, that there were changes (the badge for LOCAL CHANGES showed a non-zero number), but there were no staged or unstaged files shown. The problem was, that while loading the changes for the first time, the watcher could start the loading a second time. The first loading was cancelled, but it could have already set the first instance variable. Therefore, on the second load a shortcut was done, since there was seemingly no change.
1 parent 4e69208 commit 42db2b1

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/ViewModels/WorkingCopy.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,6 @@ public void SetData(List<Models.Change> changes, CancellationToken cancellationT
271271
return;
272272
}
273273

274-
_cached = changes;
275-
276274
var lastSelectedUnstaged = new HashSet<string>();
277275
var lastSelectedStaged = new HashSet<string>();
278276
if (_selectedUnstaged is { Count: > 0 })
@@ -321,6 +319,7 @@ public void SetData(List<Models.Change> changes, CancellationToken cancellationT
321319
return;
322320

323321
_isLoadingData = true;
322+
_cached = changes;
324323
HasUnsolvedConflicts = hasConflict;
325324
VisibleUnstaged = visibleUnstaged;
326325
VisibleStaged = visibleStaged;

0 commit comments

Comments
 (0)