Open
Description
Hi there 😄
After upgrading from v1.1.4 to v1.3.2, I noticed that my attributes were no longer shadowed by initializeAttrs()
. I started digging and stumbled upon this piece of logic introduced in #191:
Line 39 in a8fb3ba
It prevents initializeAttrs()
from doing anything the second time around, thus skipping the manual initialization of attributes. Also, it seems like this change was one of the main things addressed by the above-mentioned PR.
So, what would be the correct way now to initialize the attributes without the @attr
decorator?
Thanks!
Example
<script>
class InfoMessage extends HTMLElement {
open = true
connectedCallback() {
initializeAttrs(this, ['open'])
}
}
controller(InfoMessage)
</script>
<info-message data-open="false"></info-message>
controller(InfoMessage)
wraps originalconnectedCallback()
and calls:
Line 14 in a8fb3ba
InfoMessage
is marked asinitialized
(attrs.ts
):
Line 40 in a8fb3ba
- The original
connectedCallback()
is executed, butinitializeAttrs()
would hit that early-return condition. this.open
is stuck in its default state (true
) 😔