Skip to content

Commit 04288f6

Browse files
committed
try with a fix statedb state
1 parent 302e781 commit 04288f6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/tree-extension/src/index.ts

+18
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import { Menu, MenuBar } from '@lumino/widgets';
4545
import { NotebookTreeWidget, INotebookTree } from '@jupyter-notebook/tree';
4646

4747
import { FilesActionButtons } from './fileactions';
48+
import { IStateDB } from '@jupyterlab/statedb';
4849

4950
/**
5051
* The file browser factory.
@@ -277,6 +278,7 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
277278
ISettingRegistry,
278279
IToolbarWidgetRegistry,
279280
IFileBrowserFactory,
281+
IStateDB,
280282
],
281283
optional: [
282284
IRunningSessionManagers,
@@ -292,6 +294,7 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
292294
settingRegistry: ISettingRegistry,
293295
toolbarRegistry: IToolbarWidgetRegistry,
294296
factory: IFileBrowserFactory,
297+
stateDB: IStateDB,
295298
manager: IRunningSessionManagers | null,
296299
settingEditorTracker: ISettingEditorTracker | null,
297300
jsonSettingEditorTracker: IJSONSettingEditorTracker | null
@@ -389,6 +392,21 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
389392

390393
setCurrentToDefaultBrower();
391394

395+
// TODO: remove?
396+
// provide some default state so the file browser widths are consistent and predictable
397+
stateDB
398+
.save('file-browser-filebrowser:columns', {
399+
sizes: {
400+
name: 556.328125,
401+
file_size: 144.20312499999983,
402+
is_selected: 18,
403+
last_modified: 355.46875000000017,
404+
},
405+
})
406+
.then(async () => {
407+
await browser['listing'].restore('filebrowser');
408+
});
409+
392410
return nbTreeWidget;
393411
},
394412
};

0 commit comments

Comments
 (0)