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

Regression: "Uncaught (in promise) TypeError: i.register is not a function" #17

Open
scharfstein-dev opened this issue Mar 21, 2022 · 4 comments

Comments

@scharfstein-dev
Copy link

This was already resolved in vaadin-component-factory/vcf-autocomplete#4, but I'm seeing identical behavior now after updating from Vaadin 14 to Vaadin 23.
To briefly recap, the issue is that the plugin works in dev mode, but not in production mode. In production mode, the following error occurs (when minimization is disabled, otherwise the names are slightly more obscure):

Uncaught (in promise) TypeError: theme.register is not a function
    at Object.<anonymous> (:8080/VAADIN/build/vaadin-1-8fc6aaa21d426e2ea7fe.cache.js:53861:7)
    at __webpack_require__ (vaadin-bundle-5d8d58bfdba0286fd262.cache.js:64:30)
    at Module.253 (:8080/VAADIN/build/vaadin-4-3328ac4d35c89ec36ab9.cache.js:279:24)
    at __webpack_require__ (vaadin-bundle-5d8d58bfdba0286fd262.cache.js:64:30)
    at async Flow_Flow.flowInit (vaadin-bundle-5d8d58bfdba0286fd262.cache.js:4356:17)
    at async Object.action (vaadin-bundle-5d8d58bfdba0286fd262.cache.js:4259:21)

When navigating through the stack trace, it becomes clear that this refers to line 14 in the file theme/lumo/vcf-autocomplete-styles.js (which is theme.register(theme.id);). However, the import that was formerly missing in the file is already present, so the error cause is probably similar but not identical.

I am using Vaadin 23.0.1 and VCF Autocomplete (Java version) 2.3.2. At the time of this writing, these are the latest versions available. The Vaadin build correctly resolves the client-side dependency to @vaadin-component-factory/vcf-autocomplete:1.2.8, which is also the latest available version. Any help would be greatly appreciated.

@contradictioned
Copy link

We have the same problem here.

The problematic code part from vcf-autocomplete-styles.js is

const theme = document.createElement('dom-module');
theme.register(theme.id);

where register is not found.

My guess is, that this register comes from polymer in an earlier version of Vaadin, polymer was imported globally (or at least earlier).

What helps is, to add the following import to the above mentioned file:

import '@polymer/polymer/lib/elements/dom-module.js';

@arashnabilimca
Copy link

arashnabilimca commented Aug 23, 2022

@contradictioned thank you, your solution resolves the error for me as well. We need this fix to be merged and released, as currently the solution is a manual patch.

@rahul-raj
Copy link

I'm facing this issue when I try to run Vaadin App enabling the production mode.
My webpage was loading "forever" !! and browser console showed the above mentioned error.
I added the import statement as mentioned by @contradictioned and the error went away from the browser console.
My webpage is now loading as expected.

Just wanted to mention that this issue has some link with "enabling the production mode", just in case if it is useful for someone who is looking into this issue.

@mstahv
Copy link

mstahv commented Nov 3, 2022

Could you try 23.0.0 version, that ought to have this issue fixed. At least the demo project started properly when I tried. Sorry for the slow handling of you PR @contradictioned, keep them coming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants