Skip to content

Commit

Permalink
fix: only use default values if null or undefined is passed
Browse files Browse the repository at this point in the history
If we use the `||` operator it will use the default value if a falsy (for example `""` or `0`) value is passed as argument or config. This will result in e.g `@offLabel=""` rendering a label "Off" when we actually wanted it to not render anything. This is a regression from previous versions.
  • Loading branch information
anehx authored and knownasilya committed Feb 1, 2022
1 parent de821f4 commit 8a27c4a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addon/components/x-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ function configValue(configName, defaultValue) {
return {
get() {
return (
this.args[name] ||
(configName && this.config?.[configName]) ||
this.args[name] ??
(configName && this.config?.[configName]) ??
defaultValue
);
},
Expand Down

0 comments on commit 8a27c4a

Please sign in to comment.