From 7ccc7757913dddc5a32a700e997bdf3cdff9826e Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Fri, 20 Sep 2024 14:27:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BC=BA=E5=B0=91=20useLocation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/products/Detail/ProductsTree.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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]);