From c2ca4437c45f69c60ffc8e844a3cf07a976732ba Mon Sep 17 00:00:00 2001 From: krassowski <5832902+krassowski@users.noreply.github.com> Date: Mon, 27 May 2024 13:51:52 +0100 Subject: [PATCH] Re-render when a new section is added --- src/launcher.tsx | 3 +++ src/model.ts | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/launcher.tsx b/src/launcher.tsx index c2f65ce..d51e851 100644 --- a/src/launcher.tsx +++ b/src/launcher.tsx @@ -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; diff --git a/src/model.ts b/src/model.ts index 4a93122..7dea174 100644 --- a/src/model.ts +++ b/src/model.ts @@ -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 { + return this._sectionAdded; + } + private _sectionAdded = new Signal(this); }