-
Notifications
You must be signed in to change notification settings - Fork 883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[react] "Unset" missing properties #4534
Conversation
🦋 Changeset detectedLatest commit: a56691e The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 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 |
📊 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
|
The size of lit-html.js and lit-core.min.js are as expected. |
64155cc
to
3dd21f0
Compare
@@ -171,7 +171,6 @@ | |||
"./packages/labs/gen-wrapper-vue:test", | |||
"./packages/labs/nextjs:test", | |||
"./packages/labs/preact-signals:test", | |||
"./packages/labs/react:test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like a band-aid. I had to remove it because there's a copy of tests in packages/labs/react that are now stale and fail. I don't think it makes sense to update those files, and I don't think there's reason to keep things like tests and rollup builds in the labs directories for graduated packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strongly agree. Are there files to delete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are. I think they can be done as a separate chore task. Nothing super pressing.
@@ -490,17 +487,15 @@ suite('createComponent', () => { | |||
el.fire('foo'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line above this can be update to either no have the explicit undefined
, or the comment above it can mention that both explicit undefined
or omitting property will clear listener.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Would be cool to link to the React issue (where they are currently setting to null
).
Discussed options IRL.
Regarding React's current behavior of setting |
- add link to react issue - remove unnecessary type arg
Fixes #4497
Also related #4227
What changed
We now collect previous element props in a map and actually check off ones that we update. We then go through any remaining and set them all as
undefined
.Open questions
1. Is patch bump right for this?
It could be considered a bugfix, or it could even be considered breaking. Or a new "feature" of handling unset properties?
2. Is
undefined
the correct behavior?undefined
feels most correct in terms of semantics of "unsetting", but I wanted to see what React's future custom element support would do and it seemsreact-dom@experimental
will actually set the property asnull
if it's missing.Playground: https://lit.dev/playground/#gist=001005b1cfb39fd03ccb37e841d256e5
(The current value of the property is logged in the console)
Resolution
We'll include this in a patch release as the existing behavior is considered unexpected, therefore this is a bugfix.
Filed an issue with React regarding they're behavior of setting
null
. Setting toundefined
seems like the semantically correct thing to do.