Skip to content

Commit 07bb549

Browse files
Remove duplicated code
Signed-off-by: Andy Jakubowski <hello@andyjakubowski.com>
1 parent af2227b commit 07bb549

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

src/components/NotebookPicker.tsx

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -54,40 +54,7 @@ export class NotebookPicker extends ReactWidget {
5454
this.update();
5555
};
5656

57-
private handleChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
58-
const model = this.panel.model;
59-
if (!model) {
60-
return;
61-
}
62-
63-
const selected = event.target.value;
64-
const deepnoteMetadata = this.panel.context.model.getMetadata('deepnote');
65-
const notebooks = deepnoteMetadata?.notebooks;
66-
67-
if (notebooks && selected in notebooks) {
68-
// clone the notebook JSON
69-
const newModelData = { ...notebooks[selected] };
70-
71-
// preserve deepnote metadata *without* re-inserting all notebooks
72-
newModelData.metadata = {
73-
...(newModelData.metadata ?? {}),
74-
deepnote: {
75-
notebook_names: deepnoteMetadata?.notebook_names ?? [],
76-
notebooks: deepnoteMetadata?.notebooks ?? {}
77-
}
78-
};
79-
80-
model.fromJSON(newModelData);
81-
model.dirty = false;
82-
}
83-
84-
this.selected = selected;
85-
this.update();
86-
};
87-
8857
render(): JSX.Element {
89-
const deepnoteMetadata = this.panel.context.model.getMetadata('deepnote');
90-
const metadataNames = deepnoteMetadata?.notebook_names;
9158
const deepnoteMetadata = this.panel.context.model.getMetadata('deepnote');
9259
const metadataNames = deepnoteMetadata?.notebook_names;
9360
const names =

0 commit comments

Comments
 (0)