Skip to content

Commit 999d391

Browse files
authored
Fix: Fixed issue where pinned favorites were sometimes duplicated (#12405)
1 parent 0a405be commit 999d391

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Files.App/UserControls/Widgets/QuickAccessWidget.xaml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ await DispatcherQueue.EnqueueOrInvokeAsync(async () =>
268268
var item = await App.QuickAccessManager.Model.CreateLocationItemFromPathAsync(itemToAdd);
269269
var lastIndex = ItemsAdded.IndexOf(ItemsAdded.FirstOrDefault(x => !x.IsPinned));
270270
var isPinned = (bool?)e.Items.Where(x => x.FilePath == itemToAdd).FirstOrDefault()?.Properties["System.Home.IsPinned"] ?? false;
271+
if (ItemsAdded.Any(x => x.Path == itemToAdd))
272+
continue;
271273

272274
ItemsAdded.Insert(isPinned && lastIndex >= 0 ? lastIndex : ItemsAdded.Count, new FolderCardItem(item, Path.GetFileName(item.Text), isPinned)
273275
{
@@ -284,6 +286,8 @@ await DispatcherQueue.EnqueueOrInvokeAsync(async () =>
284286
{
285287
var item = await App.QuickAccessManager.Model.CreateLocationItemFromPathAsync(itemToAdd);
286288
var lastIndex = ItemsAdded.IndexOf(ItemsAdded.FirstOrDefault(x => !x.IsPinned));
289+
if (ItemsAdded.Any(x => x.Path == itemToAdd))
290+
continue;
287291
ItemsAdded.Insert(e.Pin && lastIndex >= 0 ? lastIndex : ItemsAdded.Count, new FolderCardItem(item, Path.GetFileName(item.Text), e.Pin) // Add just after the Recent Folders
288292
{
289293
Path = item.Path,

0 commit comments

Comments
 (0)