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

Environment variables at folder level not saving state #5612

Closed
bergercode opened this issue Jan 5, 2023 · 14 comments · Fixed by #7371
Closed

Environment variables at folder level not saving state #5612

bergercode opened this issue Jan 5, 2023 · 14 comments · Fixed by #7371
Labels
B-bug Bug: general classification N-discussion Needs: Discussion S-verified Status: Verified by maintainer

Comments

@bergercode
Copy link

Description:
When updating an environment variable at the folder level, exiting and then going back into environment variables doesn't reflect and reverts to previous assigned value.

Step 1: Create new variable "Test"
image
Step 2: Edit Variable and set header name to 'A'
image
Step 3: Exit to folder view
Step 4: Open env variables for the same folder.
Step 5: Open test assignment.
Step 6: Variables have not been updated.
image

Sometimes we found waiting ~1 minute allows config/env variable to save.

@bergercode
Copy link
Author

Version: Insomnia 2022.7.0
image

@bergercode
Copy link
Author

Update: Reverting to 2022.6.0 resolves this issue.

@bergercode bergercode changed the title Environment variable not updating Environment variable update not saving state Jan 5, 2023
@jgilbert
Copy link

jgilbert commented Jan 6, 2023

Not a workaround, but after creating the variable, exiting Insomnia and restarting, the variables would sometimes persist.

@darwinphi
Copy link

+1

@filfreire filfreire changed the title Environment variable update not saving state Environment variables at folder level not saving state Jan 20, 2023
@filfreire
Copy link
Member

Hi folks, I suspect this is because we are not saving when the tag if it is left in an error state before closing the Folder Environment editor.

So for example, when I try to define tag for a request header that doesn't exist on a request, like this:
Screenshot 2023-01-20 at 11 57 12

Right after I close the menu, I can still see the tag points to the request
Screenshot 2023-01-20 at 11 57 16

But if I reopen the folder environment editor, that specific request info is not saved:
Screenshot 2023-01-20 at 11 57 27

If you try to leave the template in a non-failure state before closing the environment editor, the state should be saving properly.

@filfreire filfreire added N-discussion Needs: Discussion B-bug Bug: general classification S-verified Status: Verified by maintainer labels Jan 20, 2023
@Trim
Copy link

Trim commented Feb 28, 2023

I've got this issue too (version 2022.7.5 on Fedora) with a valid tag of type "response body attribute":
when I was setting the tag, I got correctly the value in the live preview.

Although, after having saved the environment, there was no data saved.

I've modified manually my environment variable in the insomnia.Environment.db with:

"customer_id": "{% response 'body', 'req_77195ad5929648e282bad2181515ca47', '$.customer_portal.customer.id', 'never', 60 %}"}

Before I update it, there was only this value recorded:

"customer_id": "{% response 'body', '', '', 'never', 60 %}"}

Note, that the behavior of the environment editor is very wired: it updates the database file with lot of useless information and seems to not take data from the tag form. See below for an example.

First I open the environment editor and I add added a property named test_1234 to my base environment (value being an empty string).

The editor is still open and it already saved all these data in the insomnia.Environment.db file:

$ grep test_1234 insomnia.Environment.db:

{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590419200,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590419201,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}

Then I add a valid "response body attribute" tag as value (live preview is working), I get in the file:

{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590419200,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590419201,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438428,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438429,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438429,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438429,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438430,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438430,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438430,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438430,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449257,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449257,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449257,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449257,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449257,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449258,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449258,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449258,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449259,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449259,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449259,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449260,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449260,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449260,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451588,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451588,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451588,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451588,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451588,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451589,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451589,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451589,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451589,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451589,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451590,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451590,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451590,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451590,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451590,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451590,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451591,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451591,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451591,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451591,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451591,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451591,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}

As you can see, the tag setup state is not saved.

Finally, I click the Close button of the environment editor and I get:

{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590419200,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590419201,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438428,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438429,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438429,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438429,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438430,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438430,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438430,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590438430,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449257,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449257,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449257,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449257,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449257,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449258,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449258,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449258,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449259,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449259,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449259,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449260,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449260,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590449260,"created":1671438797203,"name":"Base Environment","data":{"test_1234":""},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451588,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451588,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451588,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451588,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451588,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451589,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451589,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451589,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451589,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451589,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451590,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451590,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451590,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451590,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451590,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451590,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451591,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451591,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451591,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451591,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451591,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}
{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451591,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}

I expected the first file update here with the correct tag setup.

Then, if I close Insomnia and start it again, I got:

{"_id":"env_c3e5edebfe723e93aa7bf99879e32b3df4814172","type":"Environment","parentId":"wrk_afc24c3c0e184168a020d70712b99b1c","modified":1677590451591,"created":1671438797203,"name":"Base Environment","data":{"test_1234":"{% response 'body', '', '', 'never', 60 %}"},"dataPropertyOrder":{"&":["test_1234"]},"color":null,"isPrivate":false,"metaSortKey":1671438797203}

Finally, it's cleaned correctly after Insomnia reboot !

But I never seen the settings I've set in the tag editor.

@dam450
Copy link

dam450 commented Mar 9, 2023

When I edit a tag, go back to the JSON Environment and make any changes (add a new line for example) the changes are saved.
I think modifying the tag is not flagging the JSON as modified.

Version: Insomnia 2023.1.0
Build date: 09/03/2023
OS: Windows_NT x64 10.0.22621
Electron: 22.0.0
Node: 16.17.1
V8: 10.8.168.20-electron.0
Architecture: x64

@Trim
Copy link

Trim commented Mar 10, 2023

When I edit a tag, go back to the JSON Environment and make any changes (add a new line for example) the changes are saved. I think modifying the tag is not flagging the JSON as modified.

Thanks, it works for me too. That's a nicer workaround :)

@mikebridge
Copy link

I'm seeing this again in the latest version. I can go into environment variables, edit them, save them. Then when I close the env editor and open them again, they have reverted.

Version: Insomnia 2023.5.7
Build date: 2023-08-30
OS: Linux x64 6.4.7-surface
Electron: 25.2.0
Node: 18.15.0
Node ABI: 116
V8: 11.4.183.23-electron.0
Architecture: x64

@EvilVir
Copy link

EvilVir commented Sep 8, 2023

Same here. Amount of regression bugs in Insomnia is insane recently. Things get broken, fixed, then broken again.

@corebreaker
Copy link

It does not work for me, even if a blank line between variable, it does not save.

@oahmed-OS
Copy link
Contributor

I have found a resolution for this issue and PR #7330 has been created with my changes. My experience with JS applications is limited so my implementation may require adjustments, but I verified it does persist changes as expected.

There are two issues at play here:

  1. The Modal is set to save changes onBlur, but I found that this was not consistently firing and I needed to click on the modal box outside of the text editor (as seen in the screenshot below) in order to force the event to fire. If a user entered something in the textbox and then clicked 'Close', the modal 'x' button at the top right, or clicked out of the modal the data did not persist.

<EnvironmentEditor
ref={environmentEditorRef}
key={requestGroup ? requestGroup._id : 'n/a'}
environmentInfo={environmentInfo}
onBlur={() => {
setState({ requestGroup });
if (environmentEditorRef.current?.isValid()) {
try {
const data = environmentEditorRef.current?.getValue();
if (state.requestGroup && data) {
models.requestGroup.update(state.requestGroup, {

Screenshot 2024-04-28 at 4 04 07 PM
  1. The requestGroup object that is loaded into the Modal is currently being fetched in the debug route. This object is not being updated once an environment override has been changed, however, it does seem like there is some trigger that re-renders this page or updates the object every couple of seconds. This means even if you made a change in the environment override that triggered the onBlur successfully, you would still need to wait a few seconds before clicking back into the Modal to see the reflected changes.

My PR proposes the following solutions:
  • Instead of saving changes onBlur, change the event that we trigger saves to be onHide. This results in a much more consistent and expected experience where changes are appropriately being stored in the database.

  • Create a collection state for the collection object and update this state on request group changes that are environment override related (with an id starting with "fld_"). Additionally, run the .measure() function from the visualizer on change to ensure the visualizer picks up on the new collection state.

My solution around collection state management may require changes to conform with idiomatic javascript. This is where my weakness shows and I am hoping someone can help adjust that piece if needed. Additionally, I do wonder if the loading and management of the collection should occur in the RequestGroupActionsDropdown component rather than in the debug route. This would require much more changes, however, and I tried to keep my changes as minimal as possible while ensuring the resolution of this issue.

I have also added playwright smoke tests within my PR so that hopefully this issue does not come back up in the future.

@oahmed-OS
Copy link
Contributor

oahmed-OS commented May 4, 2024

Unfortunately my previous PR failed some of the smoke tests with my changes so I went back and re-reviewed my changes and created PR #7371 as a result. I was able to reduce the footprint of my changes significantly using useRequestGroupPatcher() while still maintaining the fix. This should be a more acceptable solution to merge and have run the entire smoke test/test suite and verified no failing tests.

@oahmed-OS
Copy link
Contributor

oahmed-OS commented May 13, 2024

@gatzjames @jackkav @filfreire Let me know if my PR is not satisfactory and changes need to be made that I can take on. Otherwise if this is an undesired change I can reduce the PR even further to only include the OnHide changes so at least the database can correctly update on environment override changes.

Happy to make changes either way as long as some improvement can be made on this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-bug Bug: general classification N-discussion Needs: Discussion S-verified Status: Verified by maintainer
Projects
None yet
10 participants