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 }