diff --git a/src/Common/dataAccess/readCollections.ts b/src/Common/dataAccess/readCollections.ts index ecb67c876..1cc477692 100644 --- a/src/Common/dataAccess/readCollections.ts +++ b/src/Common/dataAccess/readCollections.ts @@ -1,5 +1,6 @@ import { ContainerResponse } from "@azure/cosmos"; import { Queries } from "Common/Constants"; +import * as Logger from "Common/Logger"; import { CosmosDbArtifactType } from "Contracts/FabricMessagesContract"; import { isFabric, isFabricMirroredKey } from "Platform/Fabric/FabricUtil"; import { AuthType } from "../../AuthType"; @@ -61,7 +62,14 @@ export async function readCollections(databaseId: string): Promise = Promise.resolve(); constructor() { const startKey: number = TelemetryProcessor.traceStart(Action.InitializeDataExplorer, { dataExplorerArea: Constants.Areas.ResourceTree, @@ -1197,9 +1203,11 @@ export default class Explorer { } if (userContext.apiType !== "Postgres" && userContext.apiType !== "VCoreMongo") { - userContext.authType === AuthType.ResourceToken - ? this.refreshDatabaseForResourceToken() - : await this.refreshAllDatabases(); // await: we rely on the databases to be loaded before restoring the tabs further in the flow + this.databasesRefreshed = + userContext.authType === AuthType.ResourceToken + ? this.refreshDatabaseForResourceToken() + : this.refreshAllDatabases(); + await this.databasesRefreshed; // await: we rely on the databases to be loaded before restoring the tabs further in the flow } if (!isFabricNative()) { diff --git a/src/Explorer/Panes/AddGlobalSecondaryIndexPanel/__snapshots__/AddGlobalSecondaryIndexPanel.test.tsx.snap b/src/Explorer/Panes/AddGlobalSecondaryIndexPanel/__snapshots__/AddGlobalSecondaryIndexPanel.test.tsx.snap index dcc3834b1..43a570828 100644 --- a/src/Explorer/Panes/AddGlobalSecondaryIndexPanel/__snapshots__/AddGlobalSecondaryIndexPanel.test.tsx.snap +++ b/src/Explorer/Panes/AddGlobalSecondaryIndexPanel/__snapshots__/AddGlobalSecondaryIndexPanel.test.tsx.snap @@ -146,6 +146,7 @@ exports[`AddGlobalSecondaryIndexPanel render default panel 1`] = ` explorer={ Explorer { "_isInitializingNotebooks": false, + "databasesRefreshed": Promise {}, "isFixedCollectionWithSharedThroughputSupported": [Function], "isTabsContentExpanded": [Function], "onRefreshDatabasesKeyPress": [Function], diff --git a/src/Explorer/Panes/GitHubReposPanel/__snapshots__/GitHubReposPanel.test.tsx.snap b/src/Explorer/Panes/GitHubReposPanel/__snapshots__/GitHubReposPanel.test.tsx.snap index 10eb7c791..a275b2413 100644 --- a/src/Explorer/Panes/GitHubReposPanel/__snapshots__/GitHubReposPanel.test.tsx.snap +++ b/src/Explorer/Panes/GitHubReposPanel/__snapshots__/GitHubReposPanel.test.tsx.snap @@ -18,6 +18,7 @@ exports[`GitHub Repos Panel should render Default properly 1`] = ` { "container": Explorer { "_isInitializingNotebooks": false, + "databasesRefreshed": Promise {}, "isFixedCollectionWithSharedThroughputSupported": [Function], "isTabsContentExpanded": [Function], "onRefreshDatabasesKeyPress": [Function], diff --git a/src/Explorer/Panes/StringInputPane/__snapshots__/StringInputPane.test.tsx.snap b/src/Explorer/Panes/StringInputPane/__snapshots__/StringInputPane.test.tsx.snap index a29bd6433..7843bcc04 100644 --- a/src/Explorer/Panes/StringInputPane/__snapshots__/StringInputPane.test.tsx.snap +++ b/src/Explorer/Panes/StringInputPane/__snapshots__/StringInputPane.test.tsx.snap @@ -8,6 +8,7 @@ exports[`StringInput Pane should render Create new directory properly 1`] = ` explorer={ Explorer { "_isInitializingNotebooks": false, + "databasesRefreshed": Promise {}, "isFixedCollectionWithSharedThroughputSupported": [Function], "isTabsContentExpanded": [Function], "onRefreshDatabasesKeyPress": [Function], diff --git a/src/hooks/useKnockoutExplorer.ts b/src/hooks/useKnockoutExplorer.ts index 08c926bf8..b4a568e2c 100644 --- a/src/hooks/useKnockoutExplorer.ts +++ b/src/hooks/useKnockoutExplorer.ts @@ -165,7 +165,7 @@ async function configureFabric(): Promise { explorer = createExplorerFabricLegacy(initializationMessage, data.version); await scheduleRefreshFabricToken(true); resolve(explorer); - await explorer.refreshAllDatabases(); + await explorer.databasesRefreshed; if (userContext.fabricContext.isVisible) { firstContainerOpened = true; openFirstContainer(explorer, userContext.fabricContext.databaseName); @@ -189,7 +189,7 @@ async function configureFabric(): Promise { } resolve(explorer); - await explorer.refreshAllDatabases(); + await explorer.databasesRefreshed; const { databaseName } = userContext.fabricContext; if (userContext.fabricContext.isVisible && databaseName) {