mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-02-23 12:37:25 +00:00
Remove blocking await on sample database (#2047)
* Remove blocking await on sample database * Remove compress flag to reduce bundle size * Fix typo in webpack config comment date
This commit is contained in:
parent
bd592d07af
commit
99378582ce
@ -1127,7 +1127,7 @@ export default class Explorer {
|
|||||||
await this.initNotebooks(userContext.databaseAccount);
|
await this.initNotebooks(userContext.databaseAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.refreshSampleData();
|
this.refreshSampleData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async configureCopilot(): Promise<void> {
|
public async configureCopilot(): Promise<void> {
|
||||||
@ -1152,26 +1152,27 @@ export default class Explorer {
|
|||||||
.setCopilotSampleDBEnabled(copilotEnabled && copilotUserDBEnabled && copilotSampleDBEnabled);
|
.setCopilotSampleDBEnabled(copilotEnabled && copilotUserDBEnabled && copilotSampleDBEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async refreshSampleData(): Promise<void> {
|
public refreshSampleData(): void {
|
||||||
try {
|
|
||||||
if (!userContext.sampleDataConnectionInfo) {
|
if (!userContext.sampleDataConnectionInfo) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const collection: DataModels.Collection = await readSampleCollection();
|
|
||||||
if (!collection) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const databaseId = userContext.sampleDataConnectionInfo?.databaseId;
|
const databaseId = userContext.sampleDataConnectionInfo?.databaseId;
|
||||||
if (!databaseId) {
|
if (!databaseId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sampleDataResourceTokenCollection = new ResourceTokenCollection(this, databaseId, collection, true);
|
readSampleCollection()
|
||||||
useDatabases.setState({ sampleDataResourceTokenCollection });
|
.then((collection: DataModels.Collection) => {
|
||||||
} catch (error) {
|
if (!collection) {
|
||||||
Logger.logError(getErrorMessage(error), "Explorer");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sampleDataResourceTokenCollection = new ResourceTokenCollection(this, databaseId, collection, true);
|
||||||
|
useDatabases.setState({ sampleDataResourceTokenCollection });
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
Logger.logError(getErrorMessage(error), "Explorer/refreshSampleData");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -820,7 +820,7 @@ async function updateContextForSampleData(explorer: Explorer): Promise<void> {
|
|||||||
const sampleDataConnectionInfo = parseResourceTokenConnectionString(data.connectionString);
|
const sampleDataConnectionInfo = parseResourceTokenConnectionString(data.connectionString);
|
||||||
updateUserContext({ sampleDataConnectionInfo });
|
updateUserContext({ sampleDataConnectionInfo });
|
||||||
|
|
||||||
await explorer.refreshSampleData();
|
explorer.refreshSampleData();
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SampledataconnectionResponse {
|
interface SampledataconnectionResponse {
|
||||||
|
@ -248,7 +248,8 @@ module.exports = function (_env = {}, argv = {}) {
|
|||||||
new TerserPlugin({
|
new TerserPlugin({
|
||||||
terserOptions: {
|
terserOptions: {
|
||||||
// These options increase our initial bundle size by ~5% but the builds are significantly faster and won't run out of memory
|
// These options increase our initial bundle size by ~5% but the builds are significantly faster and won't run out of memory
|
||||||
compress: false,
|
// Update 2/11/2025: we are removing this flag as our bundles sizes grew so that it can remove dead and unreachable code with compromise of build time
|
||||||
|
// compress: false,
|
||||||
mangle: {
|
mangle: {
|
||||||
keep_fnames: true,
|
keep_fnames: true,
|
||||||
keep_classnames: true,
|
keep_classnames: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user