kopia lustrzana https://github.com/shoelace-style/shoelace
add console error
rodzic
d6e6f2cb25
commit
e938f94ffc
|
@ -6,6 +6,10 @@ Components with the <sl-badge type="warning" pill>Experimental</sl-badge> badge
|
|||
|
||||
_During the beta period, these restrictions may be relaxed in the event of a mission-critical bug._ 🐛
|
||||
|
||||
## Next
|
||||
|
||||
- Added a console error that appears when menu items have duplicate values in `sl-select`
|
||||
|
||||
## 2.0.0-beta.47
|
||||
|
||||
This release improves how component dependencies are imported. If you've been cherry picking, you no longer need to import component dependencies manually. This significantly improves developer experience, making Shoelace even easier to use. For transparency, component dependencies will continue to be listed in the docs.
|
||||
|
|
|
@ -305,6 +305,17 @@ export default class SlSelect extends LitElement {
|
|||
|
||||
// Wait for items to render before gathering labels otherwise the slot won't exist
|
||||
const items = this.getItems();
|
||||
|
||||
// Check for duplicate values in menu items
|
||||
const values: string[] = [];
|
||||
items.map(item => {
|
||||
if (values.includes(item.value)) {
|
||||
console.error(`Duplicate value found in <sl-select> menu item: '${item.value}'`, item);
|
||||
}
|
||||
|
||||
values.push(item.value);
|
||||
});
|
||||
|
||||
await Promise.all(items.map(item => item.render)).then(() => this.syncItemsFromValue());
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue