From f7cccf8eac41556c8641abf02663d0fc0b5e4edf Mon Sep 17 00:00:00 2001 From: pbc1017 Date: Wed, 27 Dec 2023 20:46:43 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20edit=20activity=20particip?= =?UTF-8?q?ants=20reset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/pages/EditActivity/EditActivity.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/front/src/pages/EditActivity/EditActivity.tsx b/front/src/pages/EditActivity/EditActivity.tsx index 527e1cc..48526c5 100644 --- a/front/src/pages/EditActivity/EditActivity.tsx +++ b/front/src/pages/EditActivity/EditActivity.tsx @@ -33,7 +33,6 @@ interface ActivityState { location: string; purpose: string; content: string; - members: string; proofText: string; participants: Participant[]; proofImages: ProofImage[]; @@ -53,7 +52,6 @@ export const EditActivity = (): JSX.Element => { location: "", purpose: "", content: "", - members: "", proofText: "", participants: [], proofImages: [], @@ -66,6 +64,7 @@ export const EditActivity = (): JSX.Element => { Participant[] >([]); const clubId = userStatuses.length > 0 ? userStatuses[0].clubId : null; + const [initialLoad, setInitialLoad] = useState(3); useEffect(() => { const fetchActivityData = async () => { @@ -88,7 +87,6 @@ export const EditActivity = (): JSX.Element => { location: data.location, purpose: data.purpose, content: data.content, - members: "", // Handle this based on your data structure proofText: data.proofText, participants: data.participants, proofImages: data.proofImages, @@ -340,6 +338,12 @@ export const EditActivity = (): JSX.Element => { }; useEffect(() => { + console.log("useEffect"); + if (initialLoad > 0) { + setInitialLoad(initialLoad - 1); // 첫 로딩 후에는 false로 설정 + return; // 첫 로딩에서는 나머지 로직을 실행하지 않음 + } + removeAllParticipants(); activity.participants = []; searchMember(""); // Call this with an empty string to fetch all members initially