Flagsmith / flagsmith

Open Source Feature Flagging and Remote Config Service. Host on-prem or use our hosted version at https://flagsmith.com/
https://flagsmith.com/
BSD 3-Clause "New" or "Revised" License
4.57k stars 344 forks source link

Inconsistent empty feature values when creating or editing #4198

Open rolodato opened 2 weeks ago

rolodato commented 2 weeks ago

How are you running Flagsmith

Describe the bug

When a feature is created without a value, its value is set to null. However, if its value is set to non-empty and later set back to empty, the resulting value will be set to "". Setting the feature to have a value of null requires a manual API call.

Steps To Reproduce

  1. Create a feature without a value
  2. Click "Run test" in the Features list - that feature will have a value of null
  3. Edit the feature to have some other value
  4. Edit the feature again and delete its value
  5. Click "Run test" again - the feature will now have a value of ""

Expected behavior

Erasing a feature's value should return it to the exact same state as when it was created without a value. Because we're not making the type choice explicit in the UI, IMO the correct solution would be to always save empty features as null.

Screenshots

No response