Repository: files-community/Files
File: src/Files.App/ViewModels/ShellViewModel.cs (C#)

Code before:

			return shieldIcon;
		}

		private async Task LoadThumbnailAsync(ListedItem item, CancellationToken cancellationToken)
		{
			var loadNonCachedThumbnail = false;
			var thumbnailSize = LayoutSizeKindHelper.GetIconSize(folderSettings.LayoutMode);
			var returnIconOnly = UserSettingsService.FoldersSettingsService.ShowThumbnails == false || thumbnailSize < 48;

			// TODO Remove this property when all the layouts can support different icon sizes
			var useCurrentScale = folderSettings.LayoutMode == FolderLayoutModes.DetailsView || folderSettings.LayoutMode == FolderLayoutModes.ListView;

			byte[]? result = null;

			// Non-cached thumbnails take longer to generate
			if (item.IsFolder || !FileExtensionHelpers.IsExecutableFile(item.FileExtension))
			{
				if (!returnIconOnly)
				{
					// Get cached thumbnail
					result = await FileThumbnailHelper.GetIconAsync(
							item.ItemPath,
							thumbnailSize,
							item.IsFolder,
							IconOptions.ReturnThumbnailOnly | IconOptions.ReturnOnlyIfCached | (useCurrentScale ? IconOptions.UseCurrentScale : 0));

					cancellationToken.ThrowIfCancellationRequested();
					loadNonCachedThumbnail = true;
				}

				if (result is null)
				{
					// Get icon
					result = await FileThumbnailHelper.GetIconAsync(
							item.ItemPath,
							thumbnailSize,
							item.IsFolder,
							IconOptions.ReturnIconOnly | (useCurrentScale ? IconOptions.UseCurrentScale : 0));

					cancellationToken.ThrowIfCancellationRequested();
				}
			}
			else
			{
				// Get icon or thumbnail
				result = await FileThumbnailHelper.GetIconAsync(
						item.ItemPath,
						thumbnailSize,
						item.IsFolder,
						returnIconOnly ? IconOptions.ReturnIconOnly | (useCurrentScale ? IconOptions.UseCurrentScale : 0) : (useCurrentScale ? IconOptions.UseCurrentScale : 0));

Review comment (performance):
```suggestion
							IconOptions.ReturnThumbnailOnly | IconOptions.ReturnOnlyIfCached | (useCurrentScale ? IconOptions.UseCurrentScale : IconOptions.None));
```

Code after:

			return shieldIcon;
		}

		private async Task LoadThumbnailAsync(ListedItem item, CancellationToken cancellationToken)
		{
			var loadNonCachedThumbnail = false;
			var thumbnailSize = LayoutSizeKindHelper.GetIconSize(folderSettings.LayoutMode);
			var returnIconOnly = UserSettingsService.FoldersSettingsService.ShowThumbnails == false || thumbnailSize < 48;

			// TODO Remove this property when all the layouts can support different icon sizes
			var useCurrentScale = folderSettings.LayoutMode == FolderLayoutModes.DetailsView || folderSettings.LayoutMode == FolderLayoutModes.ListView;

			byte[]? result = null;

			// Non-cached thumbnails take longer to generate
			if (item.IsFolder || !FileExtensionHelpers.IsExecutableFile(item.FileExtension))
			{
				if (!returnIconOnly)
				{
					// Get cached thumbnail
					result = await FileThumbnailHelper.GetIconAsync(
							item.ItemPath,
							thumbnailSize,
							item.IsFolder,
							IconOptions.ReturnThumbnailOnly | IconOptions.ReturnOnlyIfCached | (useCurrentScale ? IconOptions.UseCurrentScale : IconOptions.None));

					cancellationToken.ThrowIfCancellationRequested();
					loadNonCachedThumbnail = true;
				}

				if (result is null)
				{
					// Get icon
					result = await FileThumbnailHelper.GetIconAsync(
							item.ItemPath,
							thumbnailSize,
							item.IsFolder,
							IconOptions.ReturnIconOnly | (useCurrentScale ? IconOptions.UseCurrentScale : IconOptions.None));

					cancellationToken.ThrowIfCancellationRequested();
				}
			}
			else
			{
				// Get icon or thumbnail
				result = await FileThumbnailHelper.GetIconAsync(
						item.ItemPath,
						thumbnailSize,
						item.IsFolder,
						(returnIconOnly ? IconOptions.ReturnIconOnly : IconOptions.None) | (useCurrentScale ? IconOptions.UseCurrentScale : IconOptions.None));