-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Which package(s) are affected?
Lit Core (lit / lit-html / lit-element / reactive-element)
Description
When a standard private field is decorated with @state() the name of the field is something like '#foo', which requestUpdate() then uses to get the current value of the field, here:
| const newValue = this[name as keyof this]; |
this['#foo'] does not return the value of this.#foo, it is an entirely different property, so the change detection logic fails, specifically when changing value from undefined (since the new value will appear to be undefined and so no change is detected.
A fix would be to allow requestUpdate() to take the new value as a parameter instead of looking it up by name.
Reproduction
None yet. The playground doesn't support standard accessors yet.
Workaround
Use non-standard TypeScript private fields.
Is this a regression?
No or unsure. This never worked, or I haven't tried before.
Affected versions
3.x
Browser/OS/Node environment
All
Metadata
Metadata
Assignees
Labels
Type
Projects
Status