Skip to content

Commit 7b2a15c

Browse files
authored
Fix: Fixed regressions caused by "Always apply most current layout" (#11965)
1 parent 76b6c35 commit 7b2a15c

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/Files.App/ViewModels/FolderSettingsViewModel.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,14 @@ public bool IsLayoutModeChanging
9494
set => SetProperty(ref isLayoutModeChanging, value);
9595
}
9696

97-
public Type GetLayoutType(string folderPath)
97+
public Type GetLayoutType(string folderPath, bool changeLayoutMode = true)
9898
{
9999
var prefsForPath = GetLayoutPreferencesForPath(folderPath);
100-
IsLayoutModeChanging = LayoutPreference.LayoutMode != prefsForPath.LayoutMode;
101-
LayoutPreference = prefsForPath;
100+
if (changeLayoutMode)
101+
{
102+
IsLayoutModeChanging = LayoutPreference.LayoutMode != prefsForPath.LayoutMode;
103+
LayoutPreference = prefsForPath;
104+
}
102105

103106
return (prefsForPath.LayoutMode) switch
104107
{

src/Files.App/Views/BaseShellPage.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,10 @@ public void ResetNavigationStackLayoutMode()
503503
{
504504
foreach (PageStackEntry entry in ItemDisplay.BackStack.ToList())
505505
{
506-
if (entry.Parameter is NavigationArguments args)
506+
if (entry.Parameter is NavigationArguments args &&
507+
args.NavPathParam is not null and not "Home")
507508
{
508-
var correctPageType = FolderSettings.GetLayoutType(args.NavPathParam);
509+
var correctPageType = FolderSettings.GetLayoutType(args.NavPathParam, false);
509510
if (!entry.SourcePageType.Equals(correctPageType))
510511
{
511512
int index = ItemDisplay.BackStack.IndexOf(entry);
@@ -518,9 +519,10 @@ public void ResetNavigationStackLayoutMode()
518519

519520
foreach (PageStackEntry entry in ItemDisplay.ForwardStack.ToList())
520521
{
521-
if (entry.Parameter is NavigationArguments args)
522+
if (entry.Parameter is NavigationArguments args &&
523+
args.NavPathParam is not null and not "Home")
522524
{
523-
var correctPageType = FolderSettings.GetLayoutType(args.NavPathParam);
525+
var correctPageType = FolderSettings.GetLayoutType(args.NavPathParam, false);
524526
if (!entry.SourcePageType.Equals(correctPageType))
525527
{
526528
int index = ItemDisplay.ForwardStack.IndexOf(entry);

0 commit comments

Comments
 (0)