Skip to content

Commit

Permalink
JupyterFrontEndModel: only save_changes when a change is made.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Fleming committed Jun 10, 2024
1 parent c240422 commit e27c526
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/widgets/frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export class JupyterFrontEndModel extends IpylabModel {
this._updateSessionDetails();
}
this._updateAllSessionDetails();
this.save_changes();
}

close(comm_closed?: boolean): Promise<void> {
Expand Down Expand Up @@ -85,9 +84,11 @@ export class JupyterFrontEndModel extends IpylabModel {
private _updateSessionDetails(): void {
const currentWidget = this.shell.currentWidget as any;
const current_session = currentWidget?.sessionContext?.session?.model ?? {};
this.set('current_widget_id', currentWidget?.id ?? '');
this.set('current_session', current_session);
this.save_changes();
if (this.get('current_widget_id') !== currentWidget?.id) {
this.set('current_widget_id', currentWidget?.id ?? '');
this.set('current_session', current_session);
this.save_changes();
}
}
private _updateAllSessionDetails(): void {
this.set('all_sessions', Array.from(this.sessionManager.running()));
Expand Down

0 comments on commit e27c526

Please sign in to comment.