After upgrading twincolselect to 3.3.0 (from 3.2.0), I am getting a NoSuchElementSelection when I double click an entry in the right side…
java.util.NoSuchElementException: No value present
at java.base/java.util.Optional.get(Optional.java:143)
at org.vaadin.tatu.TwinColSelect$TwinColSelectItem.lambda$new$ca65e2c8$3(TwinColSelect.java:260)
at com.vaadin.flow.component.ComponentEventBus.fireEventForListener(ComponentEventBus.java:244)
at com.vaadin.flow.component.ComponentEventBus.handleDomEvent(ComponentEventBus.java:501)
. . .
The pick mode is set to DOUBLE. There is no issue double-clicking items on the left side (the items are moved to the right side, as expected).
In debugging the TwinColSelect 3.3.0 code, I can see that the click listener is invoked twice, once with a click count of 1 and a second time with a click count of 2.
With the second invocation, I can see that the parent is clearly set (to a VerticalLayout object) until doSwapItems is invoked, at which point the parent is no longer set. Hence, the NoSuchElementException on line 260…
The problematic line updateDragImage((VerticalLayout) getParent().get()); is called in the double click listener. Because it is the old select item that has been removed from list 1, so that the getParent() is empty.
So one possible way of fixing it could be to use getParent().ifPresent(parent -> updateDragImage((VerticalLayout) parent)) instead.
Thanks for debugging and the hint. It is clear by code inspection, but for some strange reason I cannot replicate the issue. I nevertheless released 3.3.1 with the fix. Unfortunately I cannot add automated test as it is not mechanical, probably a timing issue.