diff --git a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap index 939bfd917..26107a57e 100644 --- a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap +++ b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap @@ -84,9 +84,6 @@ exports[`SettingsComponent renders 1`] = ` "visible": [Function], }, AddCollectionPane { - "_databaseOffers": HashMap { - "container": Object {}, - }, "_isSynapseLinkEnabled": [Function], "autoPilotThroughput": [Function], "autoPilotTiersList": [Function], @@ -586,9 +583,6 @@ exports[`SettingsComponent renders 1`] = ` "_refreshSparkEnabledStateForAccount": [Function], "_resetNotebookWorkspace": [Function], "addCollectionPane": AddCollectionPane { - "_databaseOffers": HashMap { - "container": Object {}, - }, "_isSynapseLinkEnabled": [Function], "autoPilotThroughput": [Function], "autoPilotTiersList": [Function], @@ -1397,9 +1391,6 @@ exports[`SettingsComponent renders 1`] = ` "visible": [Function], }, AddCollectionPane { - "_databaseOffers": HashMap { - "container": Object {}, - }, "_isSynapseLinkEnabled": [Function], "autoPilotThroughput": [Function], "autoPilotTiersList": [Function], @@ -1899,9 +1890,6 @@ exports[`SettingsComponent renders 1`] = ` "_refreshSparkEnabledStateForAccount": [Function], "_resetNotebookWorkspace": [Function], "addCollectionPane": AddCollectionPane { - "_databaseOffers": HashMap { - "container": Object {}, - }, "_isSynapseLinkEnabled": [Function], "autoPilotThroughput": [Function], "autoPilotTiersList": [Function], @@ -2723,9 +2711,6 @@ exports[`SettingsComponent renders 1`] = ` "visible": [Function], }, AddCollectionPane { - "_databaseOffers": HashMap { - "container": Object {}, - }, "_isSynapseLinkEnabled": [Function], "autoPilotThroughput": [Function], "autoPilotTiersList": [Function], @@ -3225,9 +3210,6 @@ exports[`SettingsComponent renders 1`] = ` "_refreshSparkEnabledStateForAccount": [Function], "_resetNotebookWorkspace": [Function], "addCollectionPane": AddCollectionPane { - "_databaseOffers": HashMap { - "container": Object {}, - }, "_isSynapseLinkEnabled": [Function], "autoPilotThroughput": [Function], "autoPilotTiersList": [Function], @@ -4036,9 +4018,6 @@ exports[`SettingsComponent renders 1`] = ` "visible": [Function], }, AddCollectionPane { - "_databaseOffers": HashMap { - "container": Object {}, - }, "_isSynapseLinkEnabled": [Function], "autoPilotThroughput": [Function], "autoPilotTiersList": [Function], @@ -4538,9 +4517,6 @@ exports[`SettingsComponent renders 1`] = ` "_refreshSparkEnabledStateForAccount": [Function], "_resetNotebookWorkspace": [Function], "addCollectionPane": AddCollectionPane { - "_databaseOffers": HashMap { - "container": Object {}, - }, "_isSynapseLinkEnabled": [Function], "autoPilotThroughput": [Function], "autoPilotTiersList": [Function], diff --git a/src/Explorer/Panes/AddCollectionPane.ts b/src/Explorer/Panes/AddCollectionPane.ts index d2b3f6d24..3933f120d 100644 --- a/src/Explorer/Panes/AddCollectionPane.ts +++ b/src/Explorer/Panes/AddCollectionPane.ts @@ -101,12 +101,10 @@ export default class AddCollectionPane extends ContextualPaneBase { public showUpsellMessage: ko.PureComputed; public shouldCreateMongoWildcardIndex: ko.Observable; - private _databaseOffers: HashMap; private _isSynapseLinkEnabled: ko.Computed; constructor(options: AddCollectionPaneOptions) { super(options); - this._databaseOffers = new HashMap(); this.hasAutoPilotV2FeatureFlag = ko.pureComputed(() => this.container.hasAutoPilotV2FeatureFlag()); this.ruToolTipText = ko.pureComputed(() => PricingUtils.getRuToolTipText(this.hasAutoPilotV2FeatureFlag())); this.canConfigureThroughput = ko.pureComputed(() => !this.container.isServerlessEnabled()); @@ -481,7 +479,10 @@ export default class AddCollectionPane extends ContextualPaneBase { } if (!this.databaseCreateNew()) { - this.databaseHasSharedOffer(this._databaseOffers.has(selectedDatabaseId)); + const selectedDatabase: ViewModels.Database = this.container + .databases() + .find((database: ViewModels.Database) => database.id() === selectedDatabaseId); + this.databaseHasSharedOffer(!!selectedDatabase?.offer()); } }); @@ -749,15 +750,7 @@ export default class AddCollectionPane extends ContextualPaneBase { } private _onDatabasesChange(newDatabaseIds: ViewModels.Database[]) { - const cachedDatabaseIdsList = _.map(newDatabaseIds, (database: ViewModels.Database) => { - if (database && database.offer && database.offer()) { - this._databaseOffers.set(database.id(), database.offer()); - } - - return database.id(); - }); - - this.databaseIds(cachedDatabaseIdsList); + this.databaseIds(newDatabaseIds?.map((database: ViewModels.Database) => database.id())); } private _computeOfferThroughput(): number {