pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[tree-view] Remove deprecated usage of `shell.moveItemToTrash`

Open savetheclocktower opened this issue 1 year ago • 0 comments

Identify the Bug

To delete files, tree-view uses Electron’s shell.moveItemToTrash method. That’s a synchronous method that was already deprecated in Electron 12 and is completely missing from Electron 30.

This can be fixed when we actually move to Electron 30, but there’s no reason not to backport it and fix it ahead of time.

Description of the Change

The asynchronous shell.trashItem is its replacement. Some small amount of rearrangement is needed to keep the logic working identically, but otherwise this was an easy fix.

Alternate Designs

None! This was the clear alternative.

Possible Drawbacks

In my estimation, the only things that could be affected here are things that aren’t covered by specs.

Verification Process

Specs should pass.

If you want to verify manually, try

  • deleting a file or directory in tree-view,
  • having it succeed,
  • ensuring the deleted item is removed from the tree, and
  • verifying that its parent folder becomes the new selected item.

Release Notes

  • [tree-view] Moved to a more modern API for file removal in preparation for an Electron upgrade.

savetheclocktower avatar Sep 29 '24 21:09 savetheclocktower