From e696bcba91f72f42e444641e74ee69aa857e7f6e Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Thu, 23 Oct 2025 13:15:06 +0330 Subject: [PATCH] fix tag --- src/pages/products/components/Step2Form.tsx | 24 ++++++++------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/pages/products/components/Step2Form.tsx b/src/pages/products/components/Step2Form.tsx index c29f708..a916e5f 100644 --- a/src/pages/products/components/Step2Form.tsx +++ b/src/pages/products/components/Step2Form.tsx @@ -1,4 +1,4 @@ -import { type FC, useState, useEffect } from 'react'; +import { type FC, useState } from 'react'; import Button from '../../../components/Button'; import Input from '../../../components/Input'; import Textarea from '../../../components/Textarea'; @@ -199,20 +199,14 @@ const ListInput: FC = ({ items, onChange, placeholder, label }) }; const Step2Form: FC = ({ onSubmit, loading, onPrevious, categoryId, initialData }) => { - const [formData, setFormData] = useState>({ - attributes: [], - description: '', - metaDescription: '', - tags: [], - advantages: [], - disAdvantages: [] - }); - - useEffect(() => { - if (initialData) { - setFormData(prev => ({ ...prev, ...initialData })); - } - }, [initialData]); + const [formData, setFormData] = useState>(() => ({ + attributes: initialData?.attributes || [], + description: initialData?.description || '', + metaDescription: initialData?.metaDescription || '', + tags: initialData?.tags || [], + advantages: initialData?.advantages || [], + disAdvantages: initialData?.disAdvantages || [] + })); const { data: categoryAttributesData } = useGetCategoryAttributes(categoryId || '');