From 38004088a788ff6d10e5f69d316efc4051a6e03f Mon Sep 17 00:00:00 2001 From: goodmice Date: Thu, 6 Oct 2022 15:21:25 +0500 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BF=D0=B0=D1=80=D1=81=D0=B8=D0=BD=D0=B3=D0=B0=20=D0=BF=D1=83?= =?UTF-8?q?=D1=82=D0=B8=20=D0=BF=D1=80=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D1=85=D0=BE=D0=B4=D0=B5=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20Wel?= =?UTF-8?q?lTreeSelector?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/selectors/WellTreeSelector.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/selectors/WellTreeSelector.tsx b/src/components/selectors/WellTreeSelector.tsx index 55fbc67..f2efb80 100755 --- a/src/components/selectors/WellTreeSelector.tsx +++ b/src/components/selectors/WellTreeSelector.tsx @@ -158,12 +158,13 @@ export const WellTreeSelector = memo(({ show, expand, cur }, [wellsTree]) const onSelect = useCallback((value: Key[]): void => { - const newRoot = /\/(\w+)\/(\d+)/.exec(String(value)) - const oldRoot = /\/(\w+)\/(\d+)/.exec(location.pathname) + const newRoot = /\/(\w+)\/\d+/.exec(String(value)) + const oldRoot = /\/(\w+)(?:\/\d+)?/.exec(location.pathname) if (!newRoot || !oldRoot) return let newPath = newRoot[0] - if (oldRoot[1] === newRoot[1]) { /// Если типы страниц одинаковые (deposit, cluster, well) + if (oldRoot[1] === newRoot[1]) { + /// Если типы страницы одинаковые (deposit, cluster, well), добавляем остаток старого пути const url = location.pathname.substring(oldRoot[0].length) newPath = newPath + url }