Skip to content

Environment: JSON file gets modified (default=true/false) even though "Active Environment Selection" is set to "Save to Local Memory" #1727

@hhonisch

Description

@hhonisch

Describe the bug
When "Active Environment Selection=Save to Local Memory" is selected, Thunderclient (TC) is not supposed to update the "default" field in the TC environment JSON files (which indicates whether an environment is active or not).
However, TC does update the "default" field in the environment JSON file as soon as I make any change to that environment in the TC GUI, e.g. when I edit the environment variables, modify "Link to .env file", or change the environment order so that the "sortNum" field is updated.
Therefore when I temporarily change the active environment and modify an environment of which the "active" state changed (e.g. change its variables) and eventually revert the changes in the TC GUI, Git may (depending on the order in which I did things) still show the environment JSON file as "modified" due to the updated "default" field, which is kind of annoying.

To Reproduce

  • Set "Active Environment Selection=Save to File" in TC settings
  • Create two TC environments "A" and "B", add some variables to each environment => enviroment settings are persisted in files tc_env_a.json and tc_env_b.json
  • Set active environment to "A" => observe that
    • in tc_env_a.json, the field "default" is set to "true" (because environment "A" is active)
    • in tc_env_a.json, the field "default" is set to "false" (because environment "B" is not active)
  • Now set "Active Environment Selection=Save to Memory" in TC settings, which claims that TC ... "will save the changes to the Active Environment in local memory"
  • Set active environment to "B", edit anything in the environment (e.g. add a new variable), then revert the change (e.g. remove the variable that you just added). => observe that in tc_env_b.json, the field "default" has been updated to "true", despite the claim above.

Expected behavior
As long as "Active Environment Selection=Save to Memory" is set, TC never updates the field "default" in any of the environment JSON files.

Platform:

  • OS: Windows 11
  • vscode version: 1.103.1
  • node version: 22.17.0
  • extension version: 2.38.2

Are you using the free version/paid version/trial:
paid version

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions