-
Notifications
You must be signed in to change notification settings - Fork 83
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
fix: always define custom element class version getter #7813
Conversation
Quality Gate passedIssues Measures |
@@ -4,15 +4,15 @@ | |||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | |||
*/ | |||
|
|||
export function defineCustomElement(CustomElement) { | |||
export function defineCustomElement(CustomElement, version = '24.6.0-alpha0') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, I had to move version
to an optional parameter because existing tests were using version
object field thus making them false-positive (they should have been updated when refactoring logic in #6568).
I don't have better ideas how to mimic the actual case with two copies of the defineCustomElement
loaded by the browser. At least with this logic, tests fail if Object.defineProperty
is moved back to where it was.
Description
This fixes an error with version listed as
undefined
when trying to re-define the same class with a different version:The issue is a regression from #6568 where I moved the version number from
static get version()
(always available) to be hardcoded in thedefineCustomElement
(only available for the first custom element definition).The fix is to always define a version getter, regardless of whether the custom element is already defined or not.
Type of change