Skip to content

Commit

Permalink
refactor(table): Remove table from mediator during disposal
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Jul 23, 2024
1 parent 94d17ca commit 1a5c42a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/zowe-explorer-api/src/vscode/ui/TableView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { UriPair, WebView } from "./WebView";
import { Event, EventEmitter, ExtensionContext, env } from "vscode";
import { randomUUID } from "crypto";
import { diff } from "deep-object-diff";
import { TableMediator } from "./utils/TableMediator";

export namespace Table {
/* The types of supported content for the table and how they are represented in callback functions. */
Expand Down Expand Up @@ -500,8 +501,10 @@ export namespace Table {

/**
* Closes the table view and marks it as disposed.
* Removes the table instance from the mediator if it exists.
*/
public dispose(): void {
TableMediator.getInstance().removeTable(this);
super.dispose();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { Table } from "../TableView";
import type { Table } from "../TableView";

/**
* Mediator class for managing and accessing shared tables in Zowe Explorer.
Expand Down Expand Up @@ -42,7 +42,7 @@ import { Table } from "../TableView";
* Tables can only be removed by the extender that has contributed them using {@link TableMediator.deleteTable}.
* This establishes a read-only relationship between the mediator and extenders that have not contributed the table they are trying to access.
*
* **Note** that this does not prevent an extender with access to the ID from disposing the table once they've received access to the instance.
* **Note** that this does not prevent an extender with access to the ID from disposing the table, once they've received access to the instance.
*/

export class TableMediator {
Expand Down

0 comments on commit 1a5c42a

Please sign in to comment.