-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hi JVx-Engineering Team!
On the following workscreen:
public class SimpleWorkScreen extends DataSourceWorkScreen {
public SimpleWorkScreen(IWorkScreenApplication pApplication, AbstractConnection pConnection) throws Throwable {
super(pApplication, pConnection, null);
setLayout(new UIFlowLayout());
var area = new UITextArea("init text");
add(area);
var button = new UIButton("setText", () -> area.setText("something else"));
add(button);
}
}When pressing the setText -Button, the text in the textarea will not update, even tho the response of the pressButton does contain it correctly:
[
{
"componentId": "WS1",
"changedComponents": [
{
"id": "TA159",
"text": "something else"
}
],
"name": "screen.generic",
"update": true,
"home": false
}
]As our team analyzed it, the problem seems to be the 'copying' of just the initial state.
/** Current state of the textarea value */
const [text, setText] = useState(props.text || ""); For cross-checking, adding a hook to react to changes of the properties seems to do the trick.
useEffect(() => {
setText(props.text ?? "");
}, [props.text]); Is this a viable solution for this?
Thank you for your support.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working