Skip to content
Closed
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: 3 additions & 1 deletion src/Files.App/Views/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@
if (SidebarAdaptiveViewModel.PaneHolder is not null)
SidebarAdaptiveViewModel.PaneHolder.PropertyChanged -= PaneHolder_PropertyChanged;

var navArgs = e.CurrentInstance.TabBarItemParameter?.NavigationParameter;
// Find the TabBarItem that contains this ITabBarItemContent instance
var correspondingTabItem = ViewModel.AppInstances.FirstOrDefault(tabItem => tabItem.TabItemContent == e.CurrentInstance);

Check failure on line 143 in src/Files.App/Views/MainPage.xaml.cs

View workflow job for this annotation

GitHub Actions / build (Debug, arm64)

Member 'MainPageViewModel.AppInstances' cannot be accessed with an instance reference; qualify it with a type name instead

Check failure on line 143 in src/Files.App/Views/MainPage.xaml.cs

View workflow job for this annotation

GitHub Actions / build (Release, arm64)

Member 'MainPageViewModel.AppInstances' cannot be accessed with an instance reference; qualify it with a type name instead

Check failure on line 143 in src/Files.App/Views/MainPage.xaml.cs

View workflow job for this annotation

GitHub Actions / build (Release, x64)

Member 'MainPageViewModel.AppInstances' cannot be accessed with an instance reference; qualify it with a type name instead

Check failure on line 143 in src/Files.App/Views/MainPage.xaml.cs

View workflow job for this annotation

GitHub Actions / build (Debug, x64)

Member 'MainPageViewModel.AppInstances' cannot be accessed with an instance reference; qualify it with a type name instead
var navArgs = correspondingTabItem?.NavigationParameter?.NavigationParameter;
Comment on lines +143 to +144
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FirstOrDefault lookup is performed every time the current instance changes. Consider caching this relationship or using a more efficient lookup mechanism if this event fires frequently during tab navigation.

Copilot uses AI. Check for mistakes.
if (e.CurrentInstance is IShellPanesPage currentInstance)
{
SidebarAdaptiveViewModel.PaneHolder = currentInstance;
Expand Down
Loading