Hello Team,
First thanks for this nice framework, and all the tutorials and demos around.
I was playing a little bit with the GiftCard demo, and found possibly a bug.
When you redeem a giftcard, the FetchCardSummariesQuery subscription query is correctly intercepting the redeem event, and fires a Vaadin DataRefreshEvent as per the below code
fetchQueryResult.updates().subscribe(
cardSummary -> {
logger.debug("processing query update for {}: {}", fetchCardSummariesQuery, cardSummary);
/* This is a Vaadin-specific call to update the UI as a result of data changes. */
fireEvent(new DataChangeEvent.DataRefreshEvent<>(this, cardSummary));
});
However, as you don’t override properly the equals and hashCode methods in CardSummary data class,
Vaadin will not update/refresh the entity during the push (data class relies on the fields provided in the primary constructor to build the equals and hashCode methods, so keeps the remainingValue in the equals calculation which is wrong)
See com.vaadin.data.provider.DataCommunicator#refresh
if (activeData.containsKey(id)) { // this will never be the case with your code
// Item is currently available at the client-side
if (updatedData.isEmpty()) {
markAsDirty();
}
updatedData.add(activeData.get(id));
}
In your case, the GUI is updated because you have left a pollIntervall in the GiftCardGui. I think you should remove this piece of code, which is a little bit misleading when using reactive/subscription query code.
Regards