Skip to content

Commit 53054cc

Browse files
committed
Go to root directory when changing directory handle
This is needed if we switch from one directory handle to another, otherwise the old path from the old directory handle is kept and invalid
1 parent 6a3eac1 commit 53054cc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ const plugin: JupyterFrontEndPlugin<void> = {
5252
const openDirectoryButton = new ToolbarButton({
5353
icon: folderIcon,
5454
onClick: async () => {
55-
const fileHandle = await window.showDirectoryPicker();
55+
const directoryHandle = await window.showDirectoryPicker();
5656

57-
if (fileHandle) {
58-
drive.rootHandle = fileHandle;
57+
if (directoryHandle) {
58+
drive.rootHandle = directoryHandle;
59+
60+
// Go to root directory
61+
widget.model.cd('/');
5962
}
6063
},
6164
tooltip: trans.__('Open a new folder')

0 commit comments

Comments
 (0)