Pm.environment.set called in Tests don't persist data when called by Flows

pm.environment.set called in Tests don’t persist data when called by Flows:

Details (like screenshots):
My collection has a bunch of endpoints that need to be called in sequence.
The first endpoint is a GET that returns a list or other endpoints.

For example, when I call /api/ I get my home URI:

I then use the HOME URI in the next call:

I used the Tests tab to store the values in an environment variable:

var data = JSON.parse(responseBody);
pm.environment.set('home', data.home);

Until here, everything works fine

How I found the problem:
I then created Flows (which I understand is a Beta functionality) and I was expecting to connect the dots by linking Send Requests.
Although the values are fetched correctly and the SET function is called, the values don’t persist from one to the next Send Request.

I’ve already tried:
To change the environment variables to Global.

I think this is a bug.

Answering my own question…

When running Flows, there is no point in persisting the values from the response because Flows Send Request use the result from the previous calls.
The value can be allocated to the variable through the Variables box.

The value of “home” comes from this request:

I was using the Tests tab to store the value of “home” but we don’t need to do this:

var data = JSON.parse(responseBody);
pm.environment.set("home", data.home);

We then have {{home}} used in the next request:

In Flows, I link the 2 Send Requests

And, in the second one, I say: “for this variable, use that value”

The value must come from a response example stored alongside the request.

To be fair, using Tests to store variables from the response actually helped because I needed to create response example that will be used in Flows later on.