Skip to content
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

Improve folder enumeration speed #4199

Merged
merged 20 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Files/Helpers/FileListCache/FileListCacheController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ public Task SaveFileDisplayNameToCache(string path, string displayName)
{
if (displayName == null)
{
filesCache.Remove(path);
fileNamesCache.Remove(path);
return persistentAdapter.SaveFileDisplayNameToCache(path, displayName);
}
filesCache.Set(path, displayName, new MemoryCacheEntryOptions
fileNamesCache.Set(path, displayName, new MemoryCacheEntryOptions
{
Size = 1
});
Expand Down
15 changes: 9 additions & 6 deletions Files/ViewModels/FolderSettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,20 @@ public bool IsLayoutModeChanging
set => SetProperty(ref isLayoutModeChanging, value);
}

public Type GetLayoutType(string folderPath)
public Type GetLayoutType(string folderPath, bool isPageNavigationInProgress = true)
{
var oldLayoutMode = LayoutPreference.LayoutMode;
LayoutPreference = GetLayoutPreferencesForPath(folderPath);
if (oldLayoutMode != LayoutPreference.LayoutMode)
var prefsForPath = GetLayoutPreferencesForPath(folderPath);
if (isPageNavigationInProgress)
{
IsLayoutModeChanging = true;
if (LayoutPreference.LayoutMode != prefsForPath.LayoutMode)
{
IsLayoutModeChanging = true;
}
LayoutPreference = prefsForPath;
}

Type type = null;
switch (LayoutMode)
switch (prefsForPath.LayoutMode)
{
case FolderLayoutModes.DetailsView:
type = typeof(GenericFileBrowser);
Expand Down
Loading