gatanaso/multiselect-combo-box-flow

"Cannot read property of undefined" with Vaadin 21 (Flow)

McPringle opened this issue · 5 comments

I use this component in version 3.0.2 in a dialog. Prior to Vaadin 21 it worked, after I updated to Vaadin 21 the component is not displayed anymore and inside the browser, I got the following error message:

(TypeError) : Cannot read property of undefined (reading 'confirm')

This error message is displayed eight times with different properties. I did the Vaadin Dance with no change. I tried it on my Windows 11 computer and my macOS (latest) MacBook. After I remove this component from the dialog, everything else works fine (well, without the combo box, of course).

The code which is producing the error in my project:

package org.komunumo.ui.view.admin.events;

import com.vaadin.flow.component.dialog.Dialog;
import org.komunumo.data.entity.Speaker;
import org.vaadin.gatanaso.MultiselectComboBox;

public class EventDialog extends Dialog {

    public EventDialog() {
        final var speaker = new MultiselectComboBox<Speaker>("Speaker");
        add(speaker);
    }
}
watho commented

Could you please tell me if your package.json contains a line "multiselect-combo-box": "2.4.2"'
Probably with another version.

Thx

I was able to track the error down:

To improve startup performance, I configured a package whitelist:

vaadin.whitelisted-packages=org.komunumo

The problem is an incorrect namespace for this component. The namespace is org.vaadin.gatanaso but should be org.vaadin.addons.gatanaso, because the namespace org.vaadin.addons is scanned by default.

My workaround was to extend my whitelist:

vaadin.whitelisted-packages=org.komunumo, org.vaadin.gatanaso

I hope I could explain the problem understandably.

Hi and thanks for opening this issue. I've just published the initial version of the component that should be compatible with Vaadin 22+ and uses the latest version of the web component. Could you please give it a try?

<dependency>
   <groupId>org.vaadin.gatanaso</groupId>
   <artifactId>multiselect-combo-box-flow</artifactId>
   <version>4.0.0-rc1</version>
</dependency>

Closing this for now, but let me know if the issue is still happening.

BR,
Goran

The error is still present. Please note that this is not related to Vaadin version 22, but to the vaadin.whitelisted-packages configuration option in the application.properties file. As I mentioned above, the namespace of this component is org.vaadin.gatanaso but should be org.vaadin.addons.gatanaso (as with all the other components and mentioned in the Vaadin docs) to work well when the vaadin.whitelisted-packages option is enabled.

@McPringle Ah ye, my bad, you are correct 😄 Updating the namespace would make sense to ensure things work 'out of the box'. Thank you for the detailed investigation and explanation.