diff --git a/src/internal/webawesome-element.ts b/src/internal/webawesome-element.ts index 99fcbae69..134728113 100644 --- a/src/internal/webawesome-element.ts +++ b/src/internal/webawesome-element.ts @@ -11,10 +11,10 @@ export default class WebAwesomeElement extends LitElement { @property({ type: Boolean, reflect: true, attribute: 'did-ssr' }) didSSR = isServer || Boolean(this.shadowRoot); // Store the constructor value of all `static properties = {}` - constructorProperties: Map = new Map() + constructorProperties: Map = new Map(); - constructor () { - super() + constructor() { + super(); // queueMicrotask so that we wait until any subclasses finish their constructors and *then* we record the initial properties. queueMicrotask(() => { @@ -23,22 +23,22 @@ export default class WebAwesomeElement extends LitElement { // eslint-disable-next-line if (obj.reflect && this[prop] != null) { // @ts-expect-error Leave me alone. - this.constructorProperties.set(prop, this[prop]) + this.constructorProperties.set(prop, this[prop]); } - }) - }) + }); + }); } - willUpdate (changedProperties: PropertyValues) { - super.willUpdate(changedProperties) - this.constructorProperties.forEach((value, prop) => { - // If a prop changes to `null`, we assume this happens via an attribute changing to `null`. - // @ts-expect-error leave me alone + willUpdate(changedProperties: PropertyValues) { + super.willUpdate(changedProperties); + this.constructorProperties.forEach((value, prop) => { + // If a prop changes to `null`, we assume this happens via an attribute changing to `null`. + // @ts-expect-error leave me alone // eslint-disable-next-line - if (changedProperties.has(prop) && this[prop] == null) { + if (changedProperties.has(prop) && this[prop] == null) { // @ts-expect-error leave me alone - this[prop] = value - } - }) + this[prop] = value; + } + }); } protected firstUpdated(changedProperties: Parameters[0]): void {