Skip to content

Commit

Permalink
Fix error in kernels sidebar when switching kernels, remove unused pr…
Browse files Browse the repository at this point in the history
…op (#16188)

* Do not crash if there are no sessions for kernel

* Revert snapshot incorrectly updated in #16046

* Remove unused private `shutdownAllLabel` prop from `List` and `ListWidget`
  • Loading branch information
krassowski committed Apr 19, 2024
1 parent d9631ed commit b3f0b44
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 11 additions & 7 deletions packages/running-extension/src/kernels.tsx
Expand Up @@ -325,13 +325,17 @@ namespace Private {

private get _summary(): string {
const children = this.children;
return children.length == 1
? children[0].label()
: this.trans.__(
'%1 and %2 more',
children[0].label(),
children.length - 1
);
if (children.length === 0) {
return this.trans.__('No sessions connected');
} else if (children.length == 1) {
return children[0].label();
} else {
return this.trans.__(
'%1 and %2 more',
children[0].label(),
children.length - 1
);
}
}
}

Expand Down
4 changes: 0 additions & 4 deletions packages/running/src/index.tsx
Expand Up @@ -305,7 +305,6 @@ function List(props: {
child?: boolean;
runningItems: IRunningSessions.IRunningItem[];
shutdownLabel?: string | ((item: IRunningSessions.IRunningItem) => string);
shutdownAllLabel?: string;
shutdownItemIcon?: LabIcon;
filter?: (item: IRunningSessions.IRunningItem) => Partial<IScore> | null;
translator?: ITranslator;
Expand Down Expand Up @@ -420,7 +419,6 @@ class ListWidget extends ReactWidget {
private _options: {
manager: IRunningSessions.IManager;
runningItems: IRunningSessions.IRunningItem[];
shutdownAllLabel: string;
filterProvider?: IFilterProvider;
translator?: ITranslator;
collapseToggled: ISignal<Section, boolean>;
Expand Down Expand Up @@ -461,7 +459,6 @@ class ListWidget extends ReactWidget {
<List
runningItems={options.runningItems}
shutdownLabel={options.manager.shutdownLabel}
shutdownAllLabel={options.shutdownAllLabel}
shutdownItemIcon={options.manager.shutdownItemIcon}
filter={options.filterProvider?.filter}
translator={options.translator}
Expand Down Expand Up @@ -539,7 +536,6 @@ class Section extends PanelWithToolbar {
this.addWidget(
new ListWidget({
runningItems,
shutdownAllLabel: this._shutdownAllLabel,
collapseToggled: this._collapseToggled,
...options
})
Expand Down

0 comments on commit b3f0b44

Please sign in to comment.