From 521363a296afcde6c8b25c46ef80f485a7cfca69 Mon Sep 17 00:00:00 2001 From: Cesar <26280794+csrapr@users.noreply.github.com> Date: Fri, 8 Jan 2021 18:06:25 +0000 Subject: [PATCH] Chore: remove lodash usage from BooleanPropertiesTable --- .../booleanPropertiesTable/BooleanPropertiesTable.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/new-lamassu-admin/src/components/booleanPropertiesTable/BooleanPropertiesTable.js b/new-lamassu-admin/src/components/booleanPropertiesTable/BooleanPropertiesTable.js index 3bd6b6b7..9ceb5a5e 100644 --- a/new-lamassu-admin/src/components/booleanPropertiesTable/BooleanPropertiesTable.js +++ b/new-lamassu-admin/src/components/booleanPropertiesTable/BooleanPropertiesTable.js @@ -1,7 +1,7 @@ import { makeStyles } from '@material-ui/core/styles' import classnames from 'classnames' import { useFormikContext, Form, Formik, Field as FormikField } from 'formik' -import _ from 'lodash/fp' +import * as R from 'ramda' import React, { useState, memo } from 'react' import * as Yup from 'yup' @@ -26,10 +26,11 @@ const BooleanCell = ({ name }) => { const BooleanPropertiesTable = memo( ({ title, disabled, data, elements, save, forcedEditing = false }) => { - const initialValues = _.fromPairs( - elements.map(it => [it.name, data[it.name] || null]) + const initialValues = R.fromPairs( + elements.map(it => [it.name, data[it.name] ?? null]) ) - const schemaValidation = _.fromPairs( + + const schemaValidation = R.fromPairs( elements.map(it => [it.name, Yup.boolean().required()]) ) @@ -38,8 +39,7 @@ const BooleanPropertiesTable = memo( const classes = useStyles() const innerSave = async value => { - const filteredValues = _.omitBy(_.isNil, value) - save(filteredValues) + save(R.filter(R.complement(R.isNil), value)) setEditing(false) }