New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Another fix for thumbnails #14936
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -916,7 +916,6 @@ private async Task<BitmapImage> GetShieldIcon() | |||||||||
|
||||||||||
private async Task LoadThumbnailAsync(ListedItem item) | ||||||||||
{ | ||||||||||
// Cancel if thumbnails aren't enabled | ||||||||||
var thumbnailSize = folderSettings.GetRoundedIconSize(); | ||||||||||
var returnIconOnly = UserSettingsService.FoldersSettingsService.ShowThumbnails == false || thumbnailSize < 48; | ||||||||||
|
||||||||||
|
@@ -989,8 +988,6 @@ public async Task LoadExtendedItemPropertiesAsync(ListedItem item) | |||||||||
loadGroupHeaderInfo = gp is not null && !gp.Model.Initialized && gp.GetExtendedGroupHeaderInfo is not null; | ||||||||||
} | ||||||||||
|
||||||||||
cts.Token.ThrowIfCancellationRequested(); | ||||||||||
await LoadThumbnailAsync(item); | ||||||||||
|
||||||||||
cts.Token.ThrowIfCancellationRequested(); | ||||||||||
if (item.IsLibrary || item.PrimaryItemAttribute == StorageItemTypes.File || item.IsArchive) | ||||||||||
|
@@ -1000,6 +997,9 @@ public async Task LoadExtendedItemPropertiesAsync(ListedItem item) | |||||||||
matchingStorageFile = await GetFileFromPathAsync(item.ItemPath, cts.Token); | ||||||||||
if (matchingStorageFile is not null) | ||||||||||
{ | ||||||||||
cts.Token.ThrowIfCancellationRequested(); | ||||||||||
await LoadThumbnailAsync(item); | ||||||||||
|
||||||||||
cts.Token.ThrowIfCancellationRequested(); | ||||||||||
|
||||||||||
var syncStatus = await CheckCloudDriveSyncStatusAsync(matchingStorageFile); | ||||||||||
|
@@ -1032,6 +1032,11 @@ public async Task LoadExtendedItemPropertiesAsync(ListedItem item) | |||||||||
BaseStorageFolder matchingStorageFolder = await GetFolderFromPathAsync(item.ItemPath, cts.Token); | ||||||||||
if (matchingStorageFolder is not null) | ||||||||||
{ | ||||||||||
cts.Token.ThrowIfCancellationRequested(); | ||||||||||
await LoadThumbnailAsync(item); | ||||||||||
|
||||||||||
cts.Token.ThrowIfCancellationRequested(); | ||||||||||
Comment on lines
+1036
to
+1038
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This seems to avoid crashes, but is that still going to solve the issue? |
||||||||||
|
||||||||||
if (matchingStorageFolder.DisplayName != item.Name && !matchingStorageFolder.DisplayName.StartsWith("$R", StringComparison.Ordinal)) | ||||||||||
{ | ||||||||||
cts.Token.ThrowIfCancellationRequested(); | ||||||||||
|
@@ -1097,16 +1102,15 @@ public async Task LoadExtendedItemPropertiesAsync(ListedItem item) | |||||||||
SetFileTag(item); | ||||||||||
}); | ||||||||||
} | ||||||||||
else | ||||||||||
else if (UserSettingsService.FoldersSettingsService.ShowThumbnails && item.SyncStatusUI.SyncStatus != CloudDriveSyncStatus.NotSynced && item.SyncStatusUI.SyncStatus != CloudDriveSyncStatus.Unknown) | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
{ | ||||||||||
// Try loading thumbnail for cloud files in case they weren't cached the first time | ||||||||||
if (item.SyncStatusUI.SyncStatus != CloudDriveSyncStatus.NotSynced && item.SyncStatusUI.SyncStatus != CloudDriveSyncStatus.Unknown) | ||||||||||
// Load thumbnail for folders (we initially load a basic folder icon to prevent a bug where thumbnails stop loading #14817) | ||||||||||
// Also reload thumbnails cloud files in case they weren't cached the first time | ||||||||||
_ = Task.Run(async () => | ||||||||||
{ | ||||||||||
_ = Task.Run(async () => { | ||||||||||
await Task.Delay(500); | ||||||||||
await LoadThumbnailAsync(item); | ||||||||||
}); | ||||||||||
} | ||||||||||
await Task.Delay(500); | ||||||||||
await LoadThumbnailAsync(item); | ||||||||||
}); | ||||||||||
} | ||||||||||
|
||||||||||
if (loadGroupHeaderInfo) | ||||||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is resolved when we request the thumbnail after executing
GetFolderFromPathAsync
. However, this causes a new issue where excessive scrolling crashes the app.