diff --git a/src/ui/LedgersCategorySelect/LedgersCategorySelect.js b/src/ui/LedgersCategorySelect/LedgersCategorySelect.js index 10b5f5ca9..69cecc4b4 100644 --- a/src/ui/LedgersCategorySelect/LedgersCategorySelect.js +++ b/src/ui/LedgersCategorySelect/LedgersCategorySelect.js @@ -1,11 +1,10 @@ -import React from 'react' +import React, { memo, useMemo } from 'react' import PropTypes from 'prop-types' -import { withTranslation } from 'react-i18next' -import _memoize from 'lodash/memoize' +import { useTranslation } from 'react-i18next' import Select from 'ui/Select' -const getLedgersCategories = _memoize((t) => ([ +const getLedgersCategories = (t) => [ { value: '', label: t('selector.all') }, { value: 5, label: t('ledgers.categories.exchange') }, { value: 22, label: t('ledgers.categories.position_modified') }, @@ -40,22 +39,18 @@ const getLedgersCategories = _memoize((t) => ([ { value: 905, label: t('ledgers.categories.currency_conversion') }, { value: 907, label: t('ledgers.categories.monthly_profit_payment') }, { value: 911, label: t('ledgers.categories.losses') }, -])) +] -const LedgersCategorySelect = (props) => { - const { - className, - onChange, - t, - value, - } = props +const LedgersCategorySelect = ({ className, onChange, value }) => { + const { t } = useTranslation() + const items = useMemo(() => getLedgersCategories(t), [t]) return (