Repeat with Global SetValue and a while loop inside breaks the server action

Wappler v4.1.2 M1
Mac OS X Big Sur 11.5.2

I have an API fetching some records, due to the limit of 100 records per call I am running it inside a while loop.
Here is a screenshot of the server action in its working state before the repeat gets added

A short summary of the steps
Step 1. calls the API so I can check if there are more than 100 records about to be returned.
Step 2. set a local and global variable to 1 which I will update later.
Step 3. set a local and global variable to 1 which I will update later.
Step 4. set a local and global variable to the count() of the returned records, which I will update later.
Step 5. While loop which always runs of first load

Step 6. API call, which takes 2 query parameters, first is product code I am querying, for the test I manually set this to various product codes, some with 0 records, some with 1 record, 37 records, and 394 records. The second parameter is the offset which I set dynamically {{firstRun == 1 ? 0 : (totalRecords-100)}}

Step 7. repeat to add the records to my database, not important for this issue though.

Step 8. Update the global firstRun variable to 0
Step 9. Update the global lastRun variable to either 0 or 1 depending on if it needs to run the loop again
Step 10. Update totalRecords value, so if the while runs again i can adjust the offset.

As I have mentioned this is working great so far.

I now would like to enter the Product Codes to be entered into each API call dynamically from my database, so I add a new step above everything else, and do a database multi query to fetch the 188 product codes I need.
Add a repeat step after that to repeat through each product code 1 at a time and dynamically insert its value into the API call.

Here is a screenshot of the server action with the repeat surrounding everything.

The steps inside are identical, except for the 2 API steps getting their product codes from the repeat.

This however no longer works, it becomes an infinite loop, and my first product code with 37 records, just keeps inserting over and over again into my database, it will not stop unless i manually stop it for running, the last test it inserted the same 37 records 12000 times, and never seems to be able to move on.

I have a suspicion that the SetValue steps are not Updating their relevant values or something, but I am not sure.

I have managed to cheat my way around this issue for now by adding my local / global variables outside the repeat, and then setting them inside the repeat, so my final server action looks like this, and the infinite loop is now no longer an issue.

I am no longer really sure if this would still be considered a bug, as now that I understand what it did, it kind of makes sense, but if the team can still just see what they think, and unmark it as a bug if needs be.