aboutsummaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/main/java/com/vaadin/ui/ComboBox.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/server/src/main/java/com/vaadin/ui/ComboBox.java b/server/src/main/java/com/vaadin/ui/ComboBox.java
index a976782ecc..8fadca6c35 100644
--- a/server/src/main/java/com/vaadin/ui/ComboBox.java
+++ b/server/src/main/java/com/vaadin/ui/ComboBox.java
@@ -191,6 +191,15 @@ public class ComboBox<T> extends AbstractSingleSelect<T>
if (getNewItemProvider() != null) {
Optional<T> item = getNewItemProvider().apply(itemValue);
added = item.isPresent();
+ // Fixes issue https://github.com/vaadin/framework/issues/11343
+ // Update the internal selection state immediately to avoid
+ // client side hanging. This is needed for cases that user
+ // interaction fires multi events (like adding and deleting)
+ // on a new item during the same round trip.
+ item.ifPresent(value -> {
+ setSelectedItem(value, true);
+ getDataCommunicator().reset();
+ });
} else if (getNewItemHandler() != null) {
getNewItemHandler().accept(itemValue);
// Up to the user to tell if no item was added.
@@ -446,7 +455,7 @@ public class ComboBox<T> extends AbstractSingleSelect<T>
* @since 8.0
*/
public void setDataProvider(CaptionFilter captionFilter,
- ListDataProvider<T> listDataProvider) {
+ ListDataProvider<T> listDataProvider) {
Objects.requireNonNull(listDataProvider,
"List data provider cannot be null");
@@ -610,12 +619,11 @@ public class ComboBox<T> extends AbstractSingleSelect<T>
* <p>
* The empty string {@code ""} is the default empty selection caption.
*
+ * @return the empty selection caption, not {@code null}
* @see #setEmptySelectionAllowed(boolean)
* @see #isEmptySelectionAllowed()
* @see #setEmptySelectionCaption(String)
* @see #isSelected(Object)
- *
- * @return the empty selection caption, not {@code null}
* @since 8.0
*/
public String getEmptySelectionCaption() {