From fb82815cbcd7f2e4d645e14fd853701a73dbebfb Mon Sep 17 00:00:00 2001 From: goodmice Date: Wed, 4 May 2022 15:00:26 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=BD=D0=B0=20=D0=BD=D0=B5=D0=BA=D0=BE=D1=80=D1=80=D0=B5?= =?UTF-8?q?=D0=BA=D1=82=D0=BD=D0=BE=20=D0=B2=D1=8B=D0=B1=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=BD=D1=83=D1=8E=20=D1=81=D0=BA=D0=B2=D0=B0=D0=B6=D0=B8=D0=BD?= =?UTF-8?q?=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/selectors/WellTreeSelector.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/components/selectors/WellTreeSelector.tsx b/src/components/selectors/WellTreeSelector.tsx index f354d07..38ff425 100755 --- a/src/components/selectors/WellTreeSelector.tsx +++ b/src/components/selectors/WellTreeSelector.tsx @@ -54,7 +54,7 @@ const getLabel = (wellsTree: TreeNodeData[], value?: string): string | undefined break default: break } - return value + return 'Ошибка! Скважина не найдена!' } export const WellTreeSelector = memo(({ ...other }) => { @@ -100,14 +100,9 @@ export const WellTreeSelector = memo(({ ...other }) => { ) }, []) - useEffect(() => { - setValue(getLabel(wellsTree, routeMatch?.url)) - }, [wellsTree, routeMatch]) + useEffect(() => setValue(getLabel(wellsTree, routeMatch?.url)), [wellsTree, routeMatch]) - const onChange = useCallback((value: string): void => { - if (wellsTree) - setValue(getLabel(wellsTree, value)) - }, [wellsTree]) + const onChange = useCallback((value?: string): void => setValue(getLabel(wellsTree, value)), [wellsTree]) const onSelect = useCallback((value: RawValueType | LabelInValueType): void => { if (['number', 'string'].includes(typeof value))