Oh no @pyrrho, we broke it! ![]()
Just kidding, your logic looks great and it should have worked like a charm!
From looking at the error, there might be something else setting the value of the same component. Basically, something makes a change on the value, then this runs and makes a change on the value, triggering the former event that makes change on the value, and so on (at least, this is what I believe is going on). This would explain the "Maximum call stack size exceeded" error.
I would check any "Success" event handlers on your queries, or any JS queries using setValue, it's easy to miss those when making changes. if there are none, remove all event handlers interacting with this component and add them one by one.
We are also happy to take a look at it during Office Hours, where we are able to provide live support. Bugs like this one are usually easier to debug live.