Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
flapping controls when use listener
In my application I have a set of fields and depending what you fill in then a Link element gets updated with the value entered in the fields. For that I add an event listener:
productID.addValueChangeListener(e -> updateUrl());
That just update the URL:
linkCSVDownload.setResource(new ExternalResource(newUrl));
This is the field created at UI creation:
private final Link linkCSVDownload = new Link("Click here to download CSV when fields are set",new ExternalResource(baseUrl));
When all works fine with local application, it gives weird behavior when connect with slow connection to it. We have a list of checkboxes and if we click them fast then we see some getting checked and then unchecked again. I was able to reproduce the issue when I add a sleep of 1s in updateUrl function.
So my guess is that each value change on a field call on backend the updateUrl but if takes too long and users already click on another field then it starts to act oddely (I guess the url update force a redraw of application so checkbox value changed still not processed by backend so backend put back box in unselect state).
Is there a way to avoids that?