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

Code Quality: Use RichCommands in home and sidebar #15329

Merged
merged 25 commits into from
Jun 10, 2024

Conversation

0x5bfa
Copy link
Member

@0x5bfa 0x5bfa commented May 7, 2024

Resolved / Related Issues

To prevent extra work, all changes to the Files codebase must link to an approved issue marked as Ready to build. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.

Steps used to test these changes

Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.

  1. Open Files app
  2. Right click widget item (use those three commands)
  3. Right click sidebar item (again)

Confirmed it's working
image

@yaira2
Copy link
Member

yaira2 commented May 7, 2024

Are the sidebar contexts hidden from the command palette and actions page?

@0x5bfa
Copy link
Member Author

0x5bfa commented May 8, 2024

Ouch, I forgot to do that, will do.

@0x5bfa
Copy link
Member Author

0x5bfa commented May 9, 2024

Done

@0x5bfa 0x5bfa closed this May 16, 2024
@0x5bfa 0x5bfa deleted the 5bfa/CQ-BroaderRichCommandUsage1 branch May 16, 2024 05:34
@0x5bfa 0x5bfa restored the 5bfa/CQ-BroaderRichCommandUsage1 branch May 16, 2024 05:35
@0x5bfa 0x5bfa reopened this May 16, 2024
@yaira2 yaira2 requested a review from hishitetsu May 28, 2024 16:42
Copy link
Member

@hishitetsu hishitetsu left a comment

Choose a reason for hiding this comment

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

  • The app always crashes when closing a tab.
2024-06-01 23:41:04.2830|Error|System.NullReferenceException: Object reference not set to an instance of an object.
   at Files.App.Views.PaneHolderPage.Dispose()
   at Files.App.UserControls.TabBar.TabBarItem.Dispose()
   at Files.App.UserControls.TabBar.TabBarItem.Unload()
   at Files.App.UserControls.TabBar.BaseTabBar.CloseTab(TabBarItem tabItem)
   at Files.App.UserControls.TabBar.BaseTabBar.TabView_TabCloseRequested(TabView sender, TabViewTabCloseRequestedEventArgs args)
   at WinRT._EventSource_global__Windows_Foundation_TypedEventHandler_global__Microsoft_UI_Xaml_Controls_TabView__global__Microsoft_UI_Xaml_Controls_TabViewTabCloseRequestedEventArgs_.EventState.<GetEventInvoke>b__1_0(TabView sender, TabViewTabCloseRequestedEventArgs args)
   at ABI.Windows.Foundation.TypedEventHandler`2.Do_Abi_Invoke[TSenderAbi,TResultAbi](Void* thisPtr, TSenderAbi sender, TResultAbi args)
  • OpenInNewPaneFromSidebarAction always causes a crash.
2024-06-01 23:39:49.4049|Error|System.NullReferenceException: Object reference not set to an instance of an object.
   at Files.App.Actions.OpenInNewPaneFromSidebarAction.ExecuteAsync(Object parameter)
   at Files.App.Data.Commands.ActionCommand.Execute(Object parameter)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext.<>c__DisplayClass2_0.<Post>b__0()
  • Actions with IsAccessibleGlobally set to false should be excluded from custom hotkeys.
    image

@hishitetsu
Copy link
Member

Still occasionally crashes when opening tabs or panes from the home page.

2024-06-02 22:28:52.3068|Error|System.NullReferenceException: Object reference not set to an instance of an object.
   at Files.App.Actions.OpenInNewPaneFromHomeAction.ExecuteAsync(Object parameter)
   at Files.App.Data.Commands.ActionCommand.Execute(Object parameter)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext.<>c__DisplayClass2_0.<Post>b__0()
2024-06-02 22:30:06.9409|Error|System.NullReferenceException: Object reference not set to an instance of an object.
   at Files.App.Actions.OpenInNewTabFromHomeAction.ExecuteAsync(Object parameter)
   at Files.App.Data.Commands.ActionCommand.Execute(Object parameter)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext.<>c__DisplayClass2_0.<Post>b__0()

@0x5bfa
Copy link
Member Author

0x5bfa commented Jun 2, 2024

Did you click Open command immediately after context menu opened?

@hishitetsu
Copy link
Member

Did you click Open command immediately after context menu opened?

No, I didn't. I don't know under what conditions this occurs, but I don't think the null check is a fundamental solution since it occurred during normal operation.

@yaira2
Copy link
Member

yaira2 commented Jun 4, 2024

This should help unblock #4262

@yaira2
Copy link
Member

yaira2 commented Jun 4, 2024

What's the latest on this PR?

@hishitetsu
Copy link
Member

Still occasionally crashes when opening tabs or panes from the home page.

This problem hasn't been resolved. @0x5bfa put a null check, but I think the action may still not work just not crash.
#15329 (comment)

@hishitetsu
Copy link
Member

hishitetsu commented Jun 4, 2024

I tracked down the cause of crashes. If you right-click on one item and then right-click on another item without closing the first context menu, the item set in the opening event will be overwritten to null in the first context menu's closed event.
I don't think we should clear HomePageContext.RightClickedItem when the context menu has been closed because it may make HomePageContext.RightClickedItem null during the action.

@hishitetsu
Copy link
Member

The same problem exists in the sidebar, although it doesn't crash.

@0x5bfa
Copy link
Member Author

0x5bfa commented Jun 7, 2024

Ah then this is fixed in widget?

@hishitetsu
Copy link
Member

Ah then this is fixed in widget?

Yes👍

@0x5bfa
Copy link
Member Author

0x5bfa commented Jun 7, 2024

Nice! Thank you for checking.

@hishitetsu
Copy link
Member

hishitetsu commented Jun 7, 2024

I found another issue. When I right-click a sidebar section title (Pinned, Drivers, etc.), Open in commands appear and the home page will open when executing them. The commands should not appear.

@0x5bfa
Copy link
Member Author

0x5bfa commented Jun 7, 2024

Fixed

Copy link
Member

@hishitetsu hishitetsu left a comment

Choose a reason for hiding this comment

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

LGTM

@hishitetsu hishitetsu added ready to merge Pull requests that are approved and ready to merge and removed needs - code review labels Jun 8, 2024
@yaira2
Copy link
Member

yaira2 commented Jun 9, 2024

@0x5bfa can you resolve the merge conflicts?

@yaira2 yaira2 merged commit 18e853d into files-community:main Jun 10, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull requests that are approved and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants