diff --git a/src/renderer/api/__tests__/catalog-entity-registry.test.ts b/src/renderer/api/__tests__/catalog-entity-registry.test.ts index a1a2be151f..359b293993 100644 --- a/src/renderer/api/__tests__/catalog-entity-registry.test.ts +++ b/src/renderer/api/__tests__/catalog-entity-registry.test.ts @@ -19,7 +19,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { CatalogEntityRegistry, rawItems } from "../catalog-entity-registry"; +import { CatalogEntityRegistry } from "../catalog-entity-registry"; import "../../../common/catalog-entities"; import { catalogCategoryRegistry } from "../../../common/catalog/catalog-category-registry"; @@ -42,7 +42,7 @@ describe("CatalogEntityRegistry", () => { spec: {} }]; - catalog[rawItems].replace(items); + (catalog as any).rawItems.replace(items); expect(catalog.items.length).toEqual(1); items.push({ @@ -60,7 +60,7 @@ describe("CatalogEntityRegistry", () => { spec: {} }); - catalog[rawItems].replace(items); + (catalog as any).rawItems.replace(items); expect(catalog.items.length).toEqual(2); }); @@ -81,13 +81,13 @@ describe("CatalogEntityRegistry", () => { spec: {} }]; - catalog[rawItems].replace(items); + (catalog as any).rawItems.replace(items); expect(catalog.items.length).toEqual(1); expect(catalog.items[0].status.phase).toEqual("disconnected"); items[0].status.phase = "connected"; - catalog[rawItems].replace(items); + (catalog as any).rawItems.replace(items); expect(catalog.items.length).toEqual(1); expect(catalog.items[0].status.phase).toEqual("connected"); }); @@ -125,9 +125,9 @@ describe("CatalogEntityRegistry", () => { } ]; - catalog[rawItems].replace(items); + (catalog as any).rawItems.replace(items); items.splice(0, 1); - catalog[rawItems].replace(items); + (catalog as any).rawItems.replace(items); expect(catalog.items.length).toEqual(1); expect(catalog.items[0].metadata.uid).toEqual("456"); }); diff --git a/src/renderer/api/catalog-entity-registry.ts b/src/renderer/api/catalog-entity-registry.ts index eee053ba21..ac4e6748dc 100644 --- a/src/renderer/api/catalog-entity-registry.ts +++ b/src/renderer/api/catalog-entity-registry.ts @@ -25,17 +25,15 @@ import { CatalogCategory, CatalogEntity, CatalogEntityData, catalogCategoryRegis import "../../common/catalog-entities"; import { iter } from "../utils"; -export const rawItems = Symbol(); - export class CatalogEntityRegistry { - protected [rawItems] = observable.array([], { deep: true }); + protected rawItems = observable.array([], { deep: true }); @observable protected _activeEntity: CatalogEntity; constructor(private categoryRegistry: CatalogCategoryRegistry) {} init() { subscribeToBroadcast("catalog:items", (ev, items: (CatalogEntityData & CatalogEntityKindData)[]) => { - this[rawItems].replace(items); + this.rawItems.replace(items); }); broadcastMessage("catalog:broadcast"); } @@ -49,7 +47,7 @@ export class CatalogEntityRegistry { } @computed get items() { - return Array.from(iter.filterMap(this[rawItems], rawItem => this.categoryRegistry.getEntityForData(rawItem))); + return Array.from(iter.filterMap(this.rawItems, rawItem => this.categoryRegistry.getEntityForData(rawItem))); } @computed get entities(): Map {