Skip to content

avoid loading an app that its env was not loaded yet #9194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion scopes/harmony/application/application.main.runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,14 @@ export class ApplicationMain {
*/
async loadAllAppsAsAspects(poolIds?: ComponentID[]): Promise<ComponentID[]> {
const apps = await this.listAppsComponents(poolIds);
const appIds = apps.map((app) => app.id);
// do not load apps that their env was not loaded yet. their package-json may not be up to date. e.g. it could be
// cjs, when the env needs it as esm. once it is loaded, node.js saved the package.json in the cache with no way to
// refresh it.
const appsWithEnvLoaded = apps.filter((app) => !app.state.issues.getIssueByName('NonLoadedEnv'));
if (apps.length !== appsWithEnvLoaded.length) {
this.logger.warn(`some apps were not loaded as aspects because their env was not loaded yet`);
}
const appIds = appsWithEnvLoaded.map((app) => app.id);
await this.componentAspect.getHost().loadAspects(appIds.map((id) => id.toString()));
return appIds;
}
Expand Down