Skip to content

Commit

Permalink
Re-render when a new section is added
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed May 27, 2024
1 parent a163d0e commit c2ca443
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/launcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ export class NewLauncher extends Launcher {
this._favoritesDatabase = options.favoritesDatabase;
this._settings = options.settings;
this._newModel = options.model;
this._newModel.sectionAdded.connect(() => {
this.update();
});
}
private _lastUsedDatabase: ILastUsedDatabase;
private _favoritesDatabase: IFavoritesDatabase;
Expand Down
8 changes: 7 additions & 1 deletion src/model.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { INewLauncher, ISectionOptions } from './types';
import { ISignal, Signal } from '@lumino/signaling';
import { LauncherModel } from '@jupyterlab/launcher';

export class NewModel extends LauncherModel implements INewLauncher {
sections: ISectionOptions[] = [];
addSection(options: ISectionOptions) {
this.sections.push(options);
this._sectionAdded.emit();
}
sections: ISectionOptions[] = [];
get sectionAdded(): ISignal<NewModel, void> {
return this._sectionAdded;
}
private _sectionAdded = new Signal<NewModel, void>(this);
}

0 comments on commit c2ca443

Please sign in to comment.