You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a folder is moved or deleted while it is opened in a explorer tab, the explorer tab gets into a broken state.
Example
A explorer tab has this directory opened: home\test-directory\sub-directory.
If home, test-subdirectory or sub-directory is moved (because it is renamed in a second tab; it is renamed using the native file explorer; it is deleted; etc.), then the tab remains present but almost every action performed in this tab will throw an error.
It is possible to get into a healthy state again if the user navigates up the directory hierarchy or changes the CWD (current working directory) using the change CWD form (behind the Breadcrumbs menu). It is also possible to just close the tab.
Reason for the bug
Explorer tabs do not react to their CWD getting invalid/detached.
Suggested Solution
The Windows file explorer seems to navigate up the file hierarchy until it finds an ancestor which is valid. In case no ancestor is valid (e.g. the path F:\test was open, and the device having the drive letter F got detached), the file explorer just closes.
I think it is sufficient for our file explorer if it just removes explorer tabs which CWD got detached.
Implementation Notes
A single explorer tab does already register a file system watcher for each of its CWD segments. For example, if the CWD is home\test-directory\sub-directory, three file system watchers are active:
home
home\test-directory
home\test-directory\sub-directory
This is done by creating a CwdSegmentContextProvider for each CWD segment...
useResourcesOfDirectory returns a property error. We could check if that error is set and if so, remove not just the CWD segment but the entire explorer panel from the global state.
The text was updated successfully, but these errors were encountered:
Current Behavior
If a folder is moved or deleted while it is opened in a explorer tab, the explorer tab gets into a broken state.
Example
A explorer tab has this directory opened:
home\test-directory\sub-directory
.If
home
,test-subdirectory
orsub-directory
is moved (because it is renamed in a second tab; it is renamed using the native file explorer; it is deleted; etc.), then the tab remains present but almost every action performed in this tab will throw an error.It is possible to get into a healthy state again if the user navigates up the directory hierarchy or changes the CWD (current working directory) using the change CWD form (behind the Breadcrumbs menu). It is also possible to just close the tab.
Reason for the bug
Explorer tabs do not react to their CWD getting invalid/detached.
Suggested Solution
The Windows file explorer seems to navigate up the file hierarchy until it finds an ancestor which is valid. In case no ancestor is valid (e.g. the path
F:\test
was open, and the device having the drive letter F got detached), the file explorer just closes.I think it is sufficient for our file explorer if it just removes explorer tabs which CWD got detached.
Implementation Notes
A single explorer tab does already register a file system watcher for each of its CWD segments. For example, if the CWD is
home\test-directory\sub-directory
, three file system watchers are active:home
home\test-directory
home\test-directory\sub-directory
This is done by creating a
CwdSegmentContextProvider
for each CWD segment...file-explorer/src/ui/explorer-panel/ExplorerPanel.tsx
Lines 59 to 73 in e8efeae
...and this
CwdSegmentContextProvider
"listens" for the resources in its directory:file-explorer/src/ui/cwd-segment-context/CwdSegmentDerivedValues.context.tsx
Line 53 in e8efeae
useResourcesOfDirectory
returns a propertyerror
. We could check if thaterror
is set and if so, remove not just the CWD segment but the entire explorer panel from the global state.The text was updated successfully, but these errors were encountered: