UI Builder: Repeaters bound to Client State Parameters don't refresh when the Parameter is updated

Noah Boltik
Tera Contributor

I have a repeater bound to a client state parameter "selected_projects", which is initially given a value of an array of length 1. The repeater is correctly showing 1 "row" of the contained components. I'm trying to update this client state parameter by using 'api.setState("selected_projects", ["blah", "test"]);'. This is working correctly, I validated that the client state parameter is being updated. However the repeater component doesn't seem to re-evaluate once the client state parameter updates, It will only ever show 1 row. Is there a way to manually tell a repeater component to refresh?

NoahBoltik_0-1675198188909.png

NoahBoltik_3-1675199476011.png

 

Troubleshooting steps I've taken so far: I've bound a client script to a button component such that when the button is pressed, an element is pushed to the "selected_projects" array. I added a log statement, and it is getting updated correctly: everytime I press the button, the length of the array increases. I then changed the "Data Array" property of the repeater to be scripted:

NoahBoltik_2-1675199114176.png

However, when I press the button component I added, the "Test" doesn't get logged. It is only logged when the page loads, not when the client state parameter is updated. 

 

 

6 REPLIES 6

Andrew Bettcher
Kilo Sage

I have some bizarre issues that are similar to this. Firstly, I'm sending the start and end dates from a "Range Updated" event into a client state parameter. According to a script that logs these values to the console, they are correct at that point. However, by the time these values get to my data broker, they're different.

Also, I send the sys_id of a change to a different state parameter and it arrives (according to test script that logs it to console) but, after binding it to a display form only component, it just doesn't see it.

Somewhere between the client state and the thing I want to see the client state correctly, there is a mismatch and I have no idea where or what that could be!!

andrewogles
Tera Contributor

Hey Noah, where is the data for this repeater coming from? The information might be updated correctly through the api.setState call, but it isn't being refreshed to display the new information on your repeater itself. Try a page handler event to refresh the data resource being used to populate the repeater after the API call is being made to update the client state parameter!