Commit 0a7abb3
committed
fix: allow false as a flag value
This commit updates Flag#from_api to support `false` as a valid value.
Previously, `false` values for `:feature_state_value` would would fall through
the `||` branch and end up using the value from `:value`, which in most (all?)
cases seems to be `nil`.
The previous behavior made it impossible to distinguish between the following
two cases:
- an enabled flag that has never had its value set
(and should therefore be treated as `true`)
- an enabled flag that is explicitly set to `false`
(and should therefore be treated as `false`)
With the change in this commit, the first case will be `nil`, and the second
case would be `false`. The `:value` key will now only be consulted when there
is no `:feature_state_value` key present in the JSON flag data.1 parent 046644f commit 0a7abb3
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
0 commit comments