From 245b7c4e79ec7d04938487677a6286e1daab5ee7 Mon Sep 17 00:00:00 2001 From: foxxy Date: Tue, 1 Oct 2024 14:29:32 +0300 Subject: [PATCH] MSP-4163 add memo for tokensOptions --- src/components/TokenContent/index.tsx | 49 ++++++++++++++------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/components/TokenContent/index.tsx b/src/components/TokenContent/index.tsx index b1f5a96..ef0d99c 100644 --- a/src/components/TokenContent/index.tsx +++ b/src/components/TokenContent/index.tsx @@ -7,7 +7,7 @@ import 'dayjs/locale/ru' import duration from 'dayjs/plugin/duration' import relativeTime from 'dayjs/plugin/relativeTime' import { FormComponents, Layout } from 'isp-ui-kit' -import { useEffect, useState } from 'react' +import { useEffect, useMemo, useState } from 'react' import { useForm } from 'react-hook-form' import { dateFormats } from '@constants/date.ts' @@ -172,28 +172,31 @@ const TokenContent = ({ id }: TokenPropTypes) => { } ] - const tokensOptions = [ - { - value: -1, - label: 'Бессрочно' - }, - { - value: 3600000, - label: 'Один час' - }, - { - value: 86400000, - label: 'Один день' - }, - { - value: 2592000000, - label: '30 дней' - }, - { - value: 31536000000, - label: 'Один год' - } - ] + const tokensOptions = useMemo( + () => [ + { + value: -1, + label: 'Бессрочно' + }, + { + value: 3600000, + label: 'Один час' + }, + { + value: 86400000, + label: 'Один день' + }, + { + value: 2592000000, + label: '30 дней' + }, + { + value: 31536000000, + label: 'Один год' + } + ], + [] + ) if (!id) { return }