Given a Select component on the front-end that:
- Has its options driven by a set of refdata values and
- Should be "clearable" via some mechanism (eg, selecting an empty option)
Once a value has been selected and saved to a record (eg, an agreement's Renewal Priority is set to Definitely renew), it's impossible to edit that agreement to unset the renewal priority.
The two options usually available to us for clearing something don't work:
- Setting the blank option's value property to an empty string causes that empty string to be sent to the backend. The backend doesn't interpret this a reset operation and keeps the existing value.
- Setting the blank option's value property to null doesn't work because the underlying Stripes component coalesces this into an empty string. Therefore, an empty string is eventually stored in Redux and sent to the backend as the value. Like above, the backend doesn't interpret this a reset operation and keeps the existing value.