Skip to content

Conversation

@mshanemc
Copy link
Contributor

@mshanemc mshanemc commented Jun 2, 2021

What does this PR do?

when there are multiple aliases for the username, use the last (most recent) alias

What issues does this PR fix or reference?

@W-9351642@
forcedotcom/cli#1031

const keys = alias.getKeysByValue(username);
return keys?.length ? keys[0] : undefined;
// use the most recently added alias for that username
return keys?.length ? keys[keys.length - 1] : undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

@mshanemc is alias list associated with a user guaranteed to remain in order aliases were created?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. That's how it seems to behave.
  2. We're not doing any sorting of the object keys in core that I could see
    https://github.com/forcedotcom/sfdx-core/blob/107070d43cfc223c7b4fb9bfa6c1ec1c10166b97/src/config/configGroup.ts#L217

@mshanemc mshanemc requested a review from peternhale June 4, 2021 12:59
@maggiben maggiben merged commit 18565ad into main Jun 15, 2021
@maggiben maggiben deleted the sm/fix-multiple-alias-9351642 branch June 15, 2021 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants