18
Views
2
Comments
On Parameters change running twice - bug or expected? [Reactive]

I have a screen with a Get Data and a block inside that receive an input from the Get Data's output.

When clicking a button inside the block I trigger an event.

On the screen's event handler I have a Refresh Data.

And I have an action on the block assigned to On Parameters Change event.

The problem is, when I click on the button the event handler runs (with the Refresh Data inside), then the On Parameters Changed runs, then it refreshes the data (the Get Data runs), and at last the On Parameters Changed runs again.

Why does it runs twice? At the first time no parameters has changed yet, it makes no sense.

BugReport.oml

Rank: #127

Hi Ricardo,


I don't know if it is a bug or intentional, but it is related to the fact that you pass result of data refresh directly into input parameter of the webblock.  As the value in effect has not changed on the first time the event fires, I would lean towards bug.

I had a little experiment, and it happens both for aggregates and data fetch actions.  It doesn't happen for simple assigns to local variables, so if you are unhappy about this, you could make local variables in your screen to pass into your webblock and assign the refreshed data to it, but if there is nothing big going on in your OnParameterChanged, you could just look away, it doesn't hurt.

Dorine


see attached oml for experiment


rwDemoOnParameterChanged.oml

Rank: #510

Hi, Dorine Boudry,

I have run some tests and I agree with Dorine Boudry. The problem happens when you put the DataAction result as the input parameter of the block. If you use a variable, the problem doesn't happen.  (order to do this, I set a variable after call Refresh GetUsersData on RefreshUsers Action flow).

I have tried an explanation studying the screen lifecycle, but no success.

If you could find an explanation and would be possible, please, update this thread.

Best regards.