Upgrade & pin Preact version
This commit is contained in:
@@ -38,9 +38,9 @@
|
|||||||
<script type="importmap">
|
<script type="importmap">
|
||||||
{
|
{
|
||||||
"imports": {
|
"imports": {
|
||||||
"preact": "https://unpkg.com/preact/dist/preact.module.js",
|
"preact": "https://unpkg.com/preact@10.6.4/dist/preact.module.js",
|
||||||
"preact/debug": "https://unpkg.com/preact/debug/dist/debug.module.js",
|
"preact/debug": "https://unpkg.com/preact@10.6.4/debug/dist/debug.module.js",
|
||||||
"preact/devtools": "https://unpkg.com/preact@10.5.14/devtools/dist/devtools.module.js",
|
"preact/devtools": "https://unpkg.com/preact@10.6.4/devtools/dist/devtools.module.js",
|
||||||
"stats.js": "https://unpkg.com/stats.js@0.17.0/src/Stats.js"
|
"stats.js": "https://unpkg.com/stats.js@0.17.0/src/Stats.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
27
ui/widget.js
27
ui/widget.js
@@ -142,11 +142,14 @@ export class Widget extends Component {
|
|||||||
'select',
|
'select',
|
||||||
attrs,
|
attrs,
|
||||||
choices.map(choice =>
|
choices.map(choice =>
|
||||||
h(Option, {
|
h(
|
||||||
key: choice,
|
'option',
|
||||||
value: choice,
|
{
|
||||||
disabled: attrs.readonly && value !== choice
|
key: choice,
|
||||||
})
|
disabled: attrs.readonly && value !== choice
|
||||||
|
},
|
||||||
|
choice
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
break;
|
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.
|
* Wrapper around <input /> that doesn't update it while it's in focus to allow editing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user