Skip to content

Commit 89a743c

Browse files
authored
Improve folder enumeration speed (#4199)
1 parent d31838f commit 89a743c

File tree

3 files changed

+72
-79
lines changed

3 files changed

+72
-79
lines changed

Files/Helpers/FileListCache/FileListCacheController.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ public Task SaveFileDisplayNameToCache(string path, string displayName)
9494
{
9595
if (displayName == null)
9696
{
97-
filesCache.Remove(path);
97+
fileNamesCache.Remove(path);
9898
return persistentAdapter.SaveFileDisplayNameToCache(path, displayName);
9999
}
100-
filesCache.Set(path, displayName, new MemoryCacheEntryOptions
100+
fileNamesCache.Set(path, displayName, new MemoryCacheEntryOptions
101101
{
102102
Size = 1
103103
});

Files/ViewModels/FolderSettingsViewModel.cs

+9-6
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,20 @@ public bool IsLayoutModeChanging
9494
set => SetProperty(ref isLayoutModeChanging, value);
9595
}
9696

97-
public Type GetLayoutType(string folderPath)
97+
public Type GetLayoutType(string folderPath, bool isPageNavigationInProgress = true)
9898
{
99-
var oldLayoutMode = LayoutPreference.LayoutMode;
100-
LayoutPreference = GetLayoutPreferencesForPath(folderPath);
101-
if (oldLayoutMode != LayoutPreference.LayoutMode)
99+
var prefsForPath = GetLayoutPreferencesForPath(folderPath);
100+
if (isPageNavigationInProgress)
102101
{
103-
IsLayoutModeChanging = true;
102+
if (LayoutPreference.LayoutMode != prefsForPath.LayoutMode)
103+
{
104+
IsLayoutModeChanging = true;
105+
}
106+
LayoutPreference = prefsForPath;
104107
}
105108

106109
Type type = null;
107-
switch (LayoutMode)
110+
switch (prefsForPath.LayoutMode)
108111
{
109112
case FolderLayoutModes.DetailsView:
110113
type = typeof(GenericFileBrowser);

0 commit comments

Comments
 (0)