Upgrade & pin Preact version
This commit is contained in:
27
ui/widget.js
27
ui/widget.js
@@ -142,11 +142,14 @@ export class Widget extends Component {
|
||||
'select',
|
||||
attrs,
|
||||
choices.map(choice =>
|
||||
h(Option, {
|
||||
key: choice,
|
||||
value: choice,
|
||||
disabled: attrs.readonly && value !== choice
|
||||
})
|
||||
h(
|
||||
'option',
|
||||
{
|
||||
key: choice,
|
||||
disabled: attrs.readonly && value !== choice
|
||||
},
|
||||
choice
|
||||
)
|
||||
)
|
||||
);
|
||||
break;
|
||||
@@ -172,20 +175,6 @@ export class Widget extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Special memoized option to work around https://github.com/preactjs/preact/issues/3171.
|
||||
* @extends Component<{ value: string, disabled?: boolean }>
|
||||
*/
|
||||
class Option extends Component {
|
||||
shouldComponentUpdate(/** @type {Option['props']} */ nextProps) {
|
||||
return nextProps.value !== this.props.value;
|
||||
}
|
||||
|
||||
render() {
|
||||
return h('option', this.props, this.props.value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper around <input /> that doesn't update it while it's in focus to allow editing.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user