Variables with Global Names Stopped Updating in Library Actions

Wappler Version : 5.2.3
Operating System : Windows 11
Server Model: node.js
Database Type: Mariadb
Hosting Type: Docker/Digital Ocean

Expected behavior

Starting today several Library Actions in my app that relied on updating variables within repeats leveraging their global names stopped working. The variables outside of the repeat stopped getting updated (these were features that had been in production for months). Note: the exact same code when copied from a Library action to an API action works fine.

Today I did two things: 1) updated Wappler to 5.2.3 and 2) updated node.js to the most recent version. I’m not sure which of these actions caused the issue.

Actual behavior

Variables outside of the repeat do not get updated when referencing the global name. I am able to recreate with a simple example:

How to reproduce

API Action:
image
The query simply pulls five records to iterate through
image
the variable inside the repeat is named ‘counter’ for both local and global names
The output is as expected (see below)

The Library action is set up the same way. But the inner variable never updates and is not written to the variable ‘outerCounter’ outside the repeat
image

image

json output:
{
“repeat”: [
{
“counter”: 1
},
{
“counter”: 2
},
{
“counter”: 3
},
{
“counter”: 4
},
{
“counter”: 5
}
],
“endCounter”: 5,
“exec”: {
“repeat”: [
{
“innerCounter”: 1
},
{
“innerCounter”: 1
},
{
“innerCounter”: 1
},
{
“innerCounter”: 1
},
{
“innerCounter”: 1
}
]
}
}

I was able to get my app back up by pulling the code out of the library actions and into API actions, but it would be great to be able revert to figure out how to revert to how things were working previously. Thanks for the help!

Here a small update that should fix the global variable issue from 5.2.3

app.zip (5.1 KB) unzip to lib/core.

1 Like

Thank you @patrick!

@patrick

Thanks for the update, but I am still seeing an issue in an app and if I roll back prior to 5.2.3, the app works again.

The issue is with this action that is within a While loop:

Before the while loop, I initialize the variable:

With 5.2.3 and your provided update to app.js, the action does not produce any result (nor does it error.)

Get also the file from the other topic V5.2.3 - Parallel Group in Server Connect is not working.

1 Like

:+1: That takes care of it. Thanks.

Fixed in Wappler 5.2.4