Skip to content

Commit 92126e3

Browse files
authored
Code Quality: Improved loading speed of thumbnails - part 2 (#14618)
1 parent 6718879 commit 92126e3

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/Files.App/Data/Models/ItemViewModel.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,9 @@ await Task.Run(async () =>
10631063
loadGroupHeaderInfo = gp is not null && !gp.Model.Initialized && gp.GetExtendedGroupHeaderInfo is not null;
10641064
}
10651065

1066+
cts.Token.ThrowIfCancellationRequested();
1067+
await LoadItemThumbnailAsync(item, thumbnailSize);
1068+
10661069
if (item.IsLibrary || item.PrimaryItemAttribute == StorageItemTypes.File || item.IsArchive)
10671070
{
10681071
if (!item.IsShortcut && !item.IsHiddenItem && !FtpHelpers.IsFtpPath(item.ItemPath))
@@ -1093,13 +1096,8 @@ await dispatcherQueue.EnqueueOrInvokeAsync(() =>
10931096

10941097
SetFileTag(item);
10951098
wasSyncStatusLoaded = true;
1096-
1097-
await LoadItemThumbnailAsync(item, thumbnailSize);
10981099
}
10991100
}
1100-
1101-
if (!wasSyncStatusLoaded)
1102-
await LoadItemThumbnailAsync(item, thumbnailSize);
11031101
}
11041102
else
11051103
{
@@ -1109,8 +1107,6 @@ await dispatcherQueue.EnqueueOrInvokeAsync(() =>
11091107
BaseStorageFolder matchingStorageFolder = await GetFolderFromPathAsync(item.ItemPath, cts.Token);
11101108
if (matchingStorageFolder is not null)
11111109
{
1112-
cts.Token.ThrowIfCancellationRequested();
1113-
await LoadItemThumbnailAsync(item, thumbnailSize);
11141110
if (matchingStorageFolder.DisplayName != item.Name && !matchingStorageFolder.DisplayName.StartsWith("$R", StringComparison.Ordinal))
11151111
{
11161112
cts.Token.ThrowIfCancellationRequested();
@@ -1147,11 +1143,6 @@ await dispatcherQueue.EnqueueOrInvokeAsync(() =>
11471143
wasSyncStatusLoaded = true;
11481144
}
11491145
}
1150-
if (!wasSyncStatusLoaded)
1151-
{
1152-
cts.Token.ThrowIfCancellationRequested();
1153-
await LoadItemThumbnailAsync(item, thumbnailSize);
1154-
}
11551146
}
11561147

11571148
if (loadGroupHeaderInfo && isFileTypeGroupMode)

0 commit comments

Comments
 (0)