Hi! I'm failing to prefill and monitor changes of a text field.
My current approach is to prefill the fields with this buttonClickHandler query:
apiFetchQuery.trigger({
onSuccess: function(data) {
textInput1.setValue(data.someTextField)
state1.setValue(false)
}
})
if state1 is false it means that the data hasn't been changed. To monitor changes in this textfield, I set up an event handler on textInput1 that triggers a query.
state1.setValue(true)
Unfortunately, the buttonClickHandler query triggers the event handler to run after it finished so state1.value returns true. It even is like this if I only run the event handler if {{!buttonClickHandler.isFetching}}.
Is there a best practice to achieve what I'm trying to do?
Any help is much appreciated. Thanks