From 8e08b9e21471e8d54fb99ce1e8291135159dc7aa Mon Sep 17 00:00:00 2001 From: David First Date: Mon, 1 May 2023 16:34:45 -0400 Subject: [PATCH 1/2] fix(aspect-load), filter out core-aspects even when passed with versions --- scopes/workspace/workspace/workspace-aspects-loader.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scopes/workspace/workspace/workspace-aspects-loader.ts b/scopes/workspace/workspace/workspace-aspects-loader.ts index 8d555e94e4bd..d110ebb31e2f 100644 --- a/scopes/workspace/workspace/workspace-aspects-loader.ts +++ b/scopes/workspace/workspace/workspace-aspects-loader.ts @@ -222,9 +222,14 @@ needed-for: ${neededFor || ''}. using opts: ${JSON.stringify(mergedOpts }; const mergedOpts = { ...defaultOpts, ...opts }; const idsToResolve = componentIds ? componentIds.map((id) => id.toString()) : this.harmony.extensionsIds; + // it's possible that componentIds are core-aspects that got version for some reason, remove the version to + // correctly filter them out later. + const idsToResolveWithoutVersion = componentIds + ? componentIds.map((id) => id.toStringWithoutVersion()) + : this.harmony.extensionsIds; const coreAspectsIds = this.aspectLoader.getCoreAspectIds(); const configuredAspects = this.aspectLoader.getConfiguredAspects(); - const userAspectsIds: string[] = difference(idsToResolve, coreAspectsIds); + const userAspectsIds: string[] = difference(idsToResolveWithoutVersion, coreAspectsIds); const rootAspectsIds: string[] = difference(configuredAspects, coreAspectsIds); const componentIdsToResolve = await this.workspace.resolveMultipleComponentIds(userAspectsIds); const components = await this.importAndGetAspects(componentIdsToResolve); From 7574cf808c70d71fe41ba460ce67a279620afbe5 Mon Sep 17 00:00:00 2001 From: David First Date: Mon, 1 May 2023 17:31:20 -0400 Subject: [PATCH 2/2] fix to keep the version of userAspectsIds --- .../workspace/workspace/workspace-aspects-loader.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scopes/workspace/workspace/workspace-aspects-loader.ts b/scopes/workspace/workspace/workspace-aspects-loader.ts index d110ebb31e2f..7d8acc9abd91 100644 --- a/scopes/workspace/workspace/workspace-aspects-loader.ts +++ b/scopes/workspace/workspace/workspace-aspects-loader.ts @@ -222,14 +222,13 @@ needed-for: ${neededFor || ''}. using opts: ${JSON.stringify(mergedOpts }; const mergedOpts = { ...defaultOpts, ...opts }; const idsToResolve = componentIds ? componentIds.map((id) => id.toString()) : this.harmony.extensionsIds; - // it's possible that componentIds are core-aspects that got version for some reason, remove the version to - // correctly filter them out later. - const idsToResolveWithoutVersion = componentIds - ? componentIds.map((id) => id.toStringWithoutVersion()) - : this.harmony.extensionsIds; const coreAspectsIds = this.aspectLoader.getCoreAspectIds(); const configuredAspects = this.aspectLoader.getConfiguredAspects(); - const userAspectsIds: string[] = difference(idsToResolveWithoutVersion, coreAspectsIds); + // it's possible that componentIds are core-aspects that got version for some reason, remove the version to + // correctly filter them out later. + const userAspectsIds: string[] = componentIds + ? componentIds.filter((id) => !coreAspectsIds.includes(id.toStringWithoutVersion())).map((id) => id.toString()) + : difference(this.harmony.extensionsIds, coreAspectsIds); const rootAspectsIds: string[] = difference(configuredAspects, coreAspectsIds); const componentIdsToResolve = await this.workspace.resolveMultipleComponentIds(userAspectsIds); const components = await this.importAndGetAspects(componentIdsToResolve);