konnorrogers,
@konnorrogers@ruby.social avatar

Wrote an article on how to fix the "reflected attribute" issue faced when you set properties in a constructor with Lit and why it happens

https://www.konnorrogers.com/posts/2024/designing-web-components-for-morphing

tbroyer,
@tbroyer@piaille.fr avatar

@konnorrogers I have no idea what morphing operation you're talking about, but setting the attributes from constructor initialization is clearly a bug (only happens when not using decorators, and a known issue: https://github.com/lit/lit/issues/1476) and IMO this should be worked around using getter/setter (which can also easily solve the question of what to do when the property is set to null/undefined or the attribute is removed)
See https://blog.ltgt.net/web-component-properties/ for my take on reflected properties.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • GTA5RPClips
  • DreamBathrooms
  • tacticalgear
  • magazineikmin
  • InstantRegret
  • mdbf
  • Youngstown
  • Durango
  • rosin
  • slotface
  • thenastyranch
  • everett
  • kavyap
  • khanakhh
  • JUstTest
  • normalnudes
  • modclub
  • ethstaker
  • tester
  • ngwrru68w68
  • osvaldo12
  • cubers
  • Leos
  • anitta
  • provamag3
  • cisconetworking
  • megavids
  • lostlight
  • All magazines