Clickable icon in Vaadin Grid executes code multiple times after each call of setItems()

Solution 1:

My mistake was to define the icon outside the new ComponentRenderer<> statement. Having changed the code to this seems to do the trick:

private ComponentRenderer<Icon, Transaction> getActionsRenderer() {
    return new ComponentRenderer<>(transaction -> {
        final Icon replyIcon = new Icon(VaadinIcon.ENVELOPE);
        replyIcon.addClickListener(event -> Notification.show(transaction.getOrderNumber()));
        return replyIcon;
    });
}