forcedotcom / salesforcedx-vscode

Salesforce Extensions for VS Code
https://developer.salesforce.com/tools/vscode
BSD 3-Clause "New" or "Revised" License
953 stars 406 forks source link

Unable to change the default org if nodes in config.json are not in the right order #5526

Closed ext-jeremie-giffard closed 5 months ago

ext-jeremie-giffard commented 6 months ago

Summary

Follow-up of this closed issue #4878 When i change the default org the command return a success message but the used default org isn't updated as showed in the print below:

image

Steps To Reproduce:

  1. Authorize 2 orgs
  2. Go to .sf/config.json set target-org before defaultusername and save :
    "target-org": "name_org1",
    "defaultusername": "name-org2"
  3. Switch between the orgs and check if the proper org its showed as default

Expected result

Default org successfully changed and deploy retrieve working on the right org

Actual result

The default org name isn't updated and if I try to deploy/retrieve/diff it point to the wrong org.

To set it right again

  1. Go to .sf/config.json set defaultusername before target-org and save :
    "defaultusername": "name-org2",
    "target-org": "name_org1"

Additional information

4878 @CristiCanizales I'm tagging you as you were the one working on the closed issue.

Salesforce Extension Version in VS Code: -Salesforce Package.xml Generator by Vignaesh Ram A Salesforce Extension Pack

SFDX CLI Version: @salesforce/cli/2.34.7 win32-x64 node-v21.7.1 OS and version: Windows 11 VS Code version: 1.87

mingxuanzhangsfdx commented 6 months ago

Hi @ext-jeremie-giffard I tried to follow your reproduce steps and find there are some differences:

  1. There is only the field target-org in .sf/config.json in my local whereas defaultusername is in .sfdx/sfdx-config.json. Which version of the extensions are you using?
  2. So I changed target-org to the other org manually and reloaded VS Code window. Then the active org is updated as the specified org in .sf/config.json.
  3. I tried to retrieve and the org is the same as what shows up in the org browser. So I cannot reproduce the issue.
github-actions[bot] commented 5 months ago

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.

CristiCanizales commented 5 months ago

Closing this issue as we have not received a response in a week. Feel free to reopen if it's still an issue.