Skip to content

Commit c1cbb8d

Browse files
committed
fix(withWebComponent): Fix crash if WebComponent is not present yet
1 parent 9fe072c commit c1cbb8d

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

packages/main/src/internal/withWebComponent.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,24 @@ export interface WithWebComponentPropTypes extends CommonProps {
3131

3232
export function withWebComponent<T>(WebComponent): RefForwardingComponent<Ui5DomRef, T & WithWebComponentPropTypes> {
3333
const getWebComponentMetadata = (): Ui5WebComponentMetadata => {
34-
return WebComponent.getMetadata();
34+
if (WebComponent) {
35+
return WebComponent.getMetadata();
36+
}
37+
38+
return {
39+
metadata: {
40+
events: {}
41+
},
42+
getProperties() {
43+
return {};
44+
},
45+
getSlots() {
46+
return {};
47+
},
48+
getEvents() {
49+
return {};
50+
}
51+
};
3552
};
3653

3754
const getBooleanPropsFromMetadata = (): Array<string> => {

0 commit comments

Comments
 (0)