Skip to content

Commit ae20272

Browse files
authored
fix(ui5-shellbar): do not duplicate popover menu items (#1456)
1 parent b0505ce commit ae20272

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

packages/base/src/UI5Element.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -748,10 +748,22 @@ class UI5Element extends HTMLElement {
748748
throw new Error(`"${prop}" is not a valid property name. Use a name that does not collide with DOM APIs`);
749749
}
750750

751-
if (propData.type === "boolean" && propData.defaultValue) {
751+
if (propData.type === Boolean && propData.defaultValue) {
752752
throw new Error(`Cannot set a default value for property "${prop}". All booleans are false by default.`);
753753
}
754754

755+
if (propData.type === Array) {
756+
throw new Error(`Wrong type for property "${prop}". Properties cannot be of type Array - use "multiple: true" and set "type" to the single value type, such as "String", "Object", etc...`);
757+
}
758+
759+
if (propData.type === Object && propData.defaultValue) {
760+
throw new Error(`Cannot set a default value for property "${prop}". All properties of type "Object" are empty objects by default.`);
761+
}
762+
763+
if (propData.multiple && propData.defaultValue) {
764+
throw new Error(`Cannot set a default value for property "${prop}". All multiple properties are empty arrays by default.`);
765+
}
766+
755767
Object.defineProperty(proto, prop, {
756768
get() {
757769
if (this._state[prop] !== undefined) {

packages/fiori/src/ShellBar.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ const metadata = {
138138
},
139139

140140
_menuPopoverItems: {
141-
type: Array,
142-
defaultValue: [],
141+
type: String,
142+
multiple: true,
143143
},
144144
},
145145
managedSlots: true,

0 commit comments

Comments
 (0)