Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
McPringle opened this issue Oct 24, 2021 · 5 comments
Open

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

McPringle opened this issue Oct 24, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@McPringle
Copy link

McPringle commented Oct 24, 2021

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
Copy link

watho commented Oct 26, 2021

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

Thx

@McPringle
Copy link
Author

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.

@gatanaso
Copy link
Owner

gatanaso commented Feb 9, 2022

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

@gatanaso gatanaso closed this as completed Feb 9, 2022
@McPringle
Copy link
Author

McPringle commented Feb 9, 2022

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.

@gatanaso
Copy link
Owner

gatanaso commented Feb 9, 2022

@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.

@gatanaso gatanaso reopened this Feb 9, 2022
@gatanaso gatanaso added the enhancement New feature or request label Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants