Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[react] "Unset" missing properties (#4534)
- Loading branch information
Showing
4 changed files
with
35 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
'@lit/react': patch | ||
--- | ||
|
||
Wrapped components will now keep track of JSX props from previous render that were set as a property on the element, but are now missing, and set the property to `undefined`. Note, wrapped components still do not have "default props" and missing props will be treated the same as explicitly passing in `undefined`. | ||
|
||
This fixes the previously unexpected behavior where the following JSX when first rendered with a truthy condition | ||
|
||
```jsx | ||
return condition ? <WrappedInput disabled /> : <WrappedInput />; | ||
``` | ||
|
||
would leave the `disabled` property and reflected attribute to be `true` even when the condition turns falsey. |
This file contains 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
This file contains 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
This file contains 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