This commit fixes the empty string filtering in OBW

Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
This commit is contained in:
Fernando 2021-01-21 16:59:47 -03:00 committed by GitHub
parent f012bbb7ca
commit f6fce948dc
1 changed files with 4 additions and 4 deletions

View File

@ -106,7 +106,7 @@ class BusinessDetails extends Component {
],
} );
const _updates = {
const updates = {
other_platform: otherPlatform,
other_platform_name:
otherPlatform === 'other' ? otherPlatformName : '',
@ -117,9 +117,9 @@ class BusinessDetails extends Component {
};
// Remove possible empty values like `revenue` and `other_platform`.
const updates = Object.entries( _updates ).filter( ( { value } ) => {
return value !== '';
} );
Object.keys( updates ).forEach(
( key ) => updates[ key ] === '' && delete updates[ key ]
);
const promises = [
updateProfileItems( updates ).catch( () => {