Vaadin update -> Many messages in logfile -> "Ignored listener invocation"

Hello all,

after upgrading my vaadin application from 24.3.2 to 24.6.0 I receive many entires in my logfile:

Ignored listener invocation for ui-poll event from the client side for an inert body element
Ignored listener invocation for selected-changed event from the client side for an inert vaadin-tabs element
Ignored listener invocation for opened-changed event from the client side for an inert vaadin-notification element

1-5 messages per minute are listed. Is this only an information or is something to do?

It seems it happens for example if a modal dialoge is opened and my poll listener still is active in the background:

UI.getCurrent().addPollListener(new ComponentEventListener<PollEvent>()

Why should this a problem, because I do not want to stop/start the listener by opening/closing a modal dialoge?

Regards
Thomas

Does anyone knows why this happen or a solution for it? :)

That’s the effect of the server-side modality curtain. Most probable cause is that there’s a modal dialog open, and the component receiving the event is not placed in the dialog, but it’s “below” the dialog (obscured by the modality curtain).

You can find more information here: Print a warning when an event is blocked by a modal dialog · Issue #18940 · vaadin/flow · GitHub

Under normal circumstances you can work around this by addding @AllowInert annotation to your @ClientCallable-annotated function, but yours are a different use-case:

  1. First case is a poll listener of a <body> element; there’s no place to add the @AllowInert annotation
  2. Second case is a standard calls from <vaadin-tabs> component, and there’s no place to add the @AllowInert annotation either.

The solutions for the abovementioned will probably be different. For 1. I think it’s best to open a bug report at GitHub - vaadin/flow: Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+. and ask for a setting to have ui poll event working even if there’s a modal dialog.

2 Likes

I agree, it sure is something with some modal, many times I have solved by adding that modal with type combinations.

public static void showInformationWithUI(final String text, Component component, UI ui) {
        ConfirmDialog confirmDialog = ConfirmDialogBuilder.builder()
                .withHeaderIconAndHeaderText(VaadinIcon.INFO, INFORMATION)
                .withText(text)
                .withComponent(component)
                .open();
        ui.addToModalComponent(confirmDialog);
    }

even disabling the modal in Dialog type, invoking this method always at the end you want to open your Dialog

public void openAndDisableModeless() {
        getUI().ifPresent(ui -> {
            dialog.open();
            ui.setChildComponentModal(dialog, false);
        });
    }

that is, making open first then the setChildComponentModal.

Some more information about the whole “inert” thing: https://vaadin.com/docs/latest/flow/create-ui/element-api/client-server-rpc

However, the “UI Polls not received because UI is inert because there’s a modal dialog” behavior smells like a bug to me. I think, in this case, UI polls should be allowed. But it’s best to open a bug report at Vaadin Flow and discuss the matter further.

A workaround is to manually register the PollEvent listener and make it inert allowed

        ComponentUtil.addListener(ui, PollEvent.class, event -> {
            System.out.println("Poll event: " + event);
        }, DomListenerRegistration::allowInert);

However, as Martin said, it could be good to have an override for addPollListener(ComponentEventListener<PollEvent> listener, boolean allowInert) to specify the behavior based on the use case.

Please create an issue at Flow repository if you think it could be a beneficial enhancement for the framework.

1 Like

Does this apply to my case above?

To avoid making that move of my code ?

To be honest, I don’t understand what’s your case. Is it about making ConfirmDialog not modal?

Yes more or less, but I will check it better and notify you to see.