Skip to content
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

fixed env config renaming #7823

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
5 changes: 3 additions & 2 deletions scopes/workspace/workspace/bit-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,15 @@ export class BitMap {
const config = componentMap.config;
if (!config) return;
Object.keys(config).forEach((aspectId) => {
if (aspectId === sourceId.toString()) {
const fullSourceId = this.getBitmapEntry(sourceId).id.toStringWithoutVersion();
if (aspectId === fullSourceId) {
config[targetId.toString()] = config[aspectId];
delete config[aspectId];
this.markAsChanged();
}
if (aspectId === EnvsAspect.id) {
const envConfig = config[aspectId];
if (envConfig !== REMOVE_EXTENSION_SPECIAL_SIGN && envConfig.env === sourceId.toString()) {
if (envConfig !== REMOVE_EXTENSION_SPECIAL_SIGN && envConfig.env !== sourceId.toString()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this need be!== and not ===
With!== it will replace any env for any component to the new one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it works? 🤣
envConfig.env is the env prop in the config for the currently iterated component in the bitmap.
the sourceId (should change it to the fullSoruceId) is the env we want to change.
So you are right and I have to fix it now 😨 (I was testing it on one component)

Fixed on next commit. Also fixed a case where the source env is specified with a version and it wouldn't detect it.

envConfig.env = targetId.toString();
this.markAsChanged();
}
Expand Down