perf: 产品管理: 编辑保存后, 不更新树的显示状态

main
Lei OT 10 months ago
parent 7045af0881
commit fe58f01f22

@ -41,6 +41,7 @@ const getParentKey = (key, tree) => {
const ProductsTree = ({ onNodeSelect, ...props }) => {
const { t } = useTranslation();
const [agencyProducts, editingProduct, setEditingProduct] = useProductsStore((state) => [state.agencyProducts, state.editingProduct, state.setEditingProduct]);
const [activeAgency] = useProductsStore((state) => [state.activeAgency]);
const productsTypes = useProductsTypes();
const [treeData, setTreeData] = useState([]);
@ -49,6 +50,11 @@ const ProductsTree = ({ onNodeSelect, ...props }) => {
const [expandedKeys, setExpandedKeys] = useState([]);
const [autoExpandParent, setAutoExpandParent] = useState(true);
useEffect(() => {
setExpandedKeys(productsTypes.map((item) => item.key)); //
return () => {}
}, [productsTypes, activeAgency]);
useEffect(() => {
// ;
// const title = text || r.lgc_details?.['2']?.title || r.lgc_details?.['1']?.title || '';
@ -89,7 +95,7 @@ const ProductsTree = ({ onNodeSelect, ...props }) => {
setRawTreeData(_show);
setFlattenTreeData(flattenTreeFun(_show));
setExpandedKeys(productsTypes.map((item) => item.key)); //
// setExpandedKeys(productsTypes.map((item) => item.key)); //
// setActiveKey(isEmpty(_show) ? [] : [_show[0].key]);
return () => {};

Loading…
Cancel
Save