diff --git a/src/views/products/Detail/ProductsTree.jsx b/src/views/products/Detail/ProductsTree.jsx index 65cff51..fff21cd 100644 --- a/src/views/products/Detail/ProductsTree.jsx +++ b/src/views/products/Detail/ProductsTree.jsx @@ -1,4 +1,5 @@ import { createContext, useEffect, useState } from 'react'; +import { useLocation } from 'react-router-dom'; import { Tree, Input, Divider } from 'antd'; import { CaretDownOutlined } from '@ant-design/icons'; import { useTranslation } from 'react-i18next'; @@ -42,7 +43,7 @@ const getParentKey = (key, tree) => { const ProductsTree = ({ onNodeSelect, ...props }) => { const { t } = useTranslation(); - + const location = useLocation(); const isEditPage = location.pathname.includes('edit'); const [agencyProducts, editingProduct, setEditingProduct] = useProductsStore((state) => [state.agencyProducts, state.editingProduct, state.setEditingProduct]); const [activeAgency] = useProductsStore((state) => [state.activeAgency]);