Skip to content

Commit

Permalink
Fix manager isDisposed is not set (jupyterlab#15997)
Browse files Browse the repository at this point in the history
* Fix manager isDisposed is not set

* Check the current code is buggy

* Re apply the fix and lint

* Lint the code
  • Loading branch information
fcollonval authored Mar 19, 2024
1 parent 98deb6f commit a1166c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/services/src/basemanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export abstract class BaseManager implements IManager {
if (this.isDisposed) {
return;
}
this._isDisposed = true;
this._disposed.emit(undefined);
Signal.clearData(this);
}
Expand Down
11 changes: 11 additions & 0 deletions packages/services/test/kernelspec/manager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ describe('kernel/manager', () => {
});
});

describe('#isDisposed', () => {
it('should be false when instantiating', () => {
expect(manager.isDisposed).toBe(false);
});

it('should true when disposing', () => {
manager.dispose();
expect(manager.isDisposed).toBe(true);
});
});

describe('#serverSettings', () => {
it('should get the server settings', () => {
manager.dispose();
Expand Down

0 comments on commit a1166c1

Please sign in to comment.