diff --git a/src/components/WellTreeSelector.tsx b/src/components/WellTreeSelector.tsx index c741b21..3f8a7c4 100644 --- a/src/components/WellTreeSelector.tsx +++ b/src/components/WellTreeSelector.tsx @@ -61,7 +61,6 @@ export const WellTreeSelector = () => { const history = useHistory() const routeMatch = useRouteMatch('/:route/:id') - /* eslint-disable react-hooks/exhaustive-deps */ useEffect(() => { invokeWebApiWrapperAsync( async () => { @@ -87,13 +86,16 @@ export const WellTreeSelector = () => { })), })) setWellsTree(wellsTree) - setValue(getLabel(wellsTree, routeMatch?.url)) }, setShowLoader, `Не удалось загрузить список скважин` ) }, []) + useEffect(() => { + setValue(getLabel(wellsTree, routeMatch?.url)) + }, [wellsTree, routeMatch]) + const onChange = (value: string): void => { if (wellsTree) setValue(getLabel(wellsTree, value))