Send an explicit null when clearing a custom field on the web - #277
Merged
Merged
Conversation
Emptying a member's custom field and saving silently kept the old
value: handleSave skipped empty editor values from the PUT payload
entirely, and the endpoint only upserts the entries it is given, so
the server was never asked to clear anything. The same skip meant a
stored-true boolean field could never be unticked and a multiselect
could never be emptied.
An emptied field is now pushed as {field_id, value: null} when the
server holds a value for it - an explicit clear that works against
every deployed server version, independent of the omitted-value
backend fix. Fields the server has no row for stay skipped, so
never-set fields do not accrue null rows.
Third client, third shape of the same endpoint bug: explicit-null
clients worked, Android dropped the value key (422, fixed server-side),
and the web dropped the whole entry (silent no-op, fixed here).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes clearing a member's custom field from the web app, the web sibling of the Android clear-a-field bug (#274, backend fix, automerging).
Emptying a field and saving silently kept the old value:
handleSaveskipped empty editor values from the PUT payload entirely, andPUT /v1/members/{id}/fieldsonly upserts the entries it is given, so the server was never asked to clear anything. The same skip meant a stored-true boolean field could never be unticked and a multiselect could never be emptied.An emptied field is now sent as
{field_id, value: null}when the server currently holds a value for it - an explicit clear that works against every deployed server version, independent of the #274 rollout. Fields the server has no row for stay skipped, so never-set fields do not accrue null rows.For the record, the endpoint has now collected three distinct client failure shapes: explicit-null clients always worked, Android dropped the
valuekey (422, fixed server-side in #274), and the web dropped the whole entry (silent no-op, fixed here).tsc, eslint, and a production build are clean.