Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

fix ADDON-58867: Fixed dropdown reset value while clicking on X button #209

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/main/webapp/components/BaseFormView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,13 @@ class BaseFormView extends PureComponent {
});
}

// This is the custom logic to handle the dropdown's reset value, and we are setting null value
const target_value = targetValue === 'RESET_DROPDOWN_VALUE' ? null : targetValue;
/*
* Custom logic to handle the dropdown's reset value by clicking "X" button.
* DO NOT CHANGE: value of targetValue to null or any other value. Keep it as blank string only.
* Reason: We are sending a blank string value in the API, and this validation is inside the saveData().
*/

const target_value = targetValue === 'RESET_DROPDOWN_VALUE' ? '' : targetValue;
changes[field] = { value: { $set: target_value } };

const newFields = update(this.state, { data: changes });
Expand Down