DEV: Ensure getter can always return without error (#18621)

Normally, arguments passed to components are lazily evaluated. `get prefixElementColors` will only be evaluated for `@prefixType="span"`. However, when using the Ember Inspector in development, arguments are eagerly evaluated and their values displayed in the inspector. Therefore we need to make sure that getters can always be evaluated without exceptions being thrown.
This commit is contained in:
David Taylor 2022-10-17 15:10:17 +01:00 committed by GitHub
parent 4b4dbbf580
commit 731c625042
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -52,6 +52,10 @@ export default class SectionLink extends Component {
}
get prefixElementColors() {
if (!this.args.prefixElementColors) {
return;
}
const prefixElementColors = this.args.prefixElementColors.filter((color) =>
color?.slice(0, 6)
);