[reactive-element] Fix a bug in change detection with decorated standard private accessors#4999
Merged
justinfagnani merged 4 commits intomainfrom Sep 29, 2025
Merged
[reactive-element] Fix a bug in change detection with decorated standard private accessors#4999justinfagnani merged 4 commits intomainfrom
justinfagnani merged 4 commits intomainfrom
Conversation
…ard private accessors.
🦋 Changeset detectedLatest commit: 014af72 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
📊 Tachometer Benchmark ResultsSummarynop-update
render
update
update-reflect
Resultsthis-change
render
update
update-reflect
this-change, tip-of-tree, previous-release
render
update
nop-update
this-change, tip-of-tree, previous-release
render
update
this-change, tip-of-tree, previous-release
render
update
update-reflect
|
Contributor
|
The size of lit-html.js and lit-core.min.js are as expected. |
augustjk
approved these changes
May 23, 2025
Member
augustjk
left a comment
There was a problem hiding this comment.
need size check update as per comment above but otherwise looks good to me. suggestions for minor fixes.
packages/reactive-element/src/test/decorators-modern/decorators-standard/README.md
Outdated
Show resolved
Hide resolved
packages/reactive-element/src/test/decorators-modern/decorators-standard/state_test.ts
Outdated
Show resolved
Hide resolved
sorvell
reviewed
May 23, 2025
Co-authored-by: Augustine Kim <augustjkim@gmail.com>
Merged
kevinpschaaf
added a commit
to breadboard-ai/breadboard
that referenced
this pull request
Jan 15, 2026
) Fixes b/475312122 When the record button is clicked, the private `#recorder` field is set, which is what changes the template from the "record" button to the "stop" button. Since `#recorder` wasn't marked as `state()`, the template wasn't re-rendered based on this assignment, and since clicking the button immediately disables it, there was no way to stop recording. Appears to have been a latent bug, exposed by #7458 (found via bisect). That PR resulted in `lit` being bumped from `3.3.1` to `3.3.2`, which included a bugfix in the lit core library: lit/lit#4999 "Fix a bug in change detection with decorated standard private accessors". The reason the fix in Lit broke Opal was because that in the same microtask that `#recorder` was being set, the `#clearValues()` method was being called which did set the `@state() #value` field to `null`. Since `null` is the initial value, this should not have triggered a re-render but did, because of the Lit bug above: Lit reading `newValue` in `requestUpdate` incorrectly returned `undefined` for a private field, hence setting to `null` always failed equality check and incorrectly triggered an update (compensating for `#recorder` not being marked as state). The fix to Lit means that nothing was triggering a re-render after the record button was clicked. Thus ensuring that the `#recorder` field was properly marked as `@state` is all that's needed.
kevinpschaaf
added a commit
to breadboard-ai/breadboard
that referenced
this pull request
Jan 16, 2026
) Fixes b/475312122 When the record button is clicked, the private `#recorder` field is set, which is what changes the template from the "record" button to the "stop" button. Since `#recorder` wasn't marked as `state()`, the template wasn't re-rendered based on this assignment, and since clicking the button immediately disables it, there was no way to stop recording. Appears to have been a latent bug, exposed by #7458 (found via bisect). That PR resulted in `lit` being bumped from `3.3.1` to `3.3.2`, which included a bugfix in the lit core library: lit/lit#4999 "Fix a bug in change detection with decorated standard private accessors". The reason the fix in Lit broke Opal was because that in the same microtask that `#recorder` was being set, the `#clearValues()` method was being called which did set the `@state() #value` field to `null`. Since `null` is the initial value, this should not have triggered a re-render but did, because of the Lit bug above: Lit reading `newValue` in `requestUpdate` incorrectly returned `undefined` for a private field, hence setting to `null` always failed equality check and incorrectly triggered an update (compensating for `#recorder` not being marked as state). The fix to Lit means that nothing was triggering a re-render after the record button was clicked. Thus ensuring that the `#recorder` field was properly marked as `@state` is all that's needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4998