Skip to content

Commit

Permalink
fix(framework): getComponentFeature can return undefined (#10456)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladitasev authored Jan 3, 2025
1 parent ef59e50 commit 7da765c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/base/src/FeaturesRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const registerComponentFeature = async (name: string, feature: typeof ComponentF
notifyForFeatureLoad(name);
};

const getComponentFeature = <T>(name: string): T => {
const getComponentFeature = <T>(name: string): T | undefined => {
return componentFeatures.get(name) as T;
};

Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/ColorPalette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ class ColorPalette extends UI5Element {

if (this.showMoreColors) {
const ColorPaletteMoreColorsClass = getComponentFeature<typeof ColorPaletteMoreColors>("ColorPaletteMoreColors");
ColorPaletteMoreColorsClass.i18nBundle = ColorPalette.i18nBundle;
if (ColorPaletteMoreColorsClass) {
ColorPaletteMoreColorsClass.i18nBundle = ColorPalette.i18nBundle;
this.moreColorsFeature = new ColorPaletteMoreColorsClass();
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1263,8 +1263,8 @@ class Input extends UI5Element implements SuggestionComponent, IFormInputElement
}

const Suggestions = getComponentFeature<typeof InputSuggestions>("InputSuggestions");
Suggestions.i18nBundle = Input.i18nBundle;
if (Suggestions) {
Suggestions.i18nBundle = Input.i18nBundle;
this.Suggestions = new Suggestions(this, "suggestionItems", true, false);
}
}
Expand Down

0 comments on commit 7da765c

Please sign in to comment.