Skip to content

Fix: Fixed issue were clicking tags in columns layout would crash app #11718

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

Merged
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
15 changes: 12 additions & 3 deletions src/Files.App/Views/BaseShellPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,20 @@ public void SubmitSearch(string query, bool searchUnindexedItems)
FilesystemViewModel.CancelSearch();
InstanceViewModel.CurrentSearchQuery = query;
InstanceViewModel.SearchedUnindexedItems = searchUnindexedItems;
ItemDisplay.Navigate(InstanceViewModel.FolderSettings.GetLayoutType(FilesystemViewModel.WorkingDirectory), new NavigationArguments()

var args = new NavigationArguments()
{
AssociatedTabInstance = this,
IsSearchResultPage = true,
SearchPathParam = FilesystemViewModel.WorkingDirectory,
SearchQuery = query,
SearchUnindexedItems = searchUnindexedItems,
});
};

if (this is ColumnShellPage)
NavigateToPath(FilesystemViewModel.WorkingDirectory, typeof(DetailsLayoutBrowser), args);
else
ItemDisplay.Navigate(InstanceViewModel.FolderSettings.GetLayoutType(FilesystemViewModel.WorkingDirectory), args);
}

public void NavigateWithArguments(Type sourcePageType, NavigationArguments navArgs)
Expand All @@ -479,7 +485,10 @@ public void NavigateWithArguments(Type sourcePageType, NavigationArguments navAr

public void NavigateToPath(string navigationPath, NavigationArguments? navArgs = null)
{
NavigateToPath(navigationPath, FolderSettings.GetLayoutType(navigationPath), navArgs);
var layout = navigationPath.StartsWith("tag:")
? typeof(DetailsLayoutBrowser)
: FolderSettings.GetLayoutType(navigationPath);
NavigateToPath(navigationPath, layout, navArgs);
}

public Task TabItemDragOver(object sender, DragEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Views/ColumnShellPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public override void Forward_Click()

public override void Up_Click()
{
this.FindAscendant<ColumnViewBrowser>().NavigateUp();
this.FindAscendant<ColumnViewBrowser>()?.NavigateUp();
}

public override void NavigateToPath(string navigationPath, Type sourcePageType, NavigationArguments navArgs = null)
Expand Down
8 changes: 7 additions & 1 deletion src/Files.App/Views/LayoutModes/ColumnViewBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,13 @@ public void MoveFocusToNextBlade(int currentBladeIndex)

public void SetSelectedPathOrNavigate(string navigationPath, Type sourcePageType, NavigationArguments navArgs = null)
{
var destPath = navArgs is not null ? (navArgs.IsSearchResultPage ? navArgs.SearchPathParam : navArgs.NavPathParam) : navigationPath;
if (navArgs is not null && navArgs.IsSearchResultPage)
{
ParentShellPageInstance?.NavigateToPath(navArgs.SearchPathParam, typeof(DetailsLayoutBrowser), navArgs);
return;
}

var destPath = navArgs is not null ? navArgs.NavPathParam : navigationPath;
var columnPath = ((ColumnHost.ActiveBlades.Last().Content as Frame)?.Content as ColumnShellPage)?.FilesystemViewModel.WorkingDirectory;
var columnFirstPath = ((ColumnHost.ActiveBlades.First().Content as Frame)?.Content as ColumnShellPage)?.FilesystemViewModel.WorkingDirectory;

Expand Down