From 60db0cc79e1bd4ec3d6a725519194878b2aaf78f Mon Sep 17 00:00:00 2001 From: Gyeongho Yang Date: Tue, 5 Nov 2024 22:37:10 +0900 Subject: [PATCH] fix: forget previous options on auto --- frontend/src/pages/enhance/6-execute/potential/potential.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/src/pages/enhance/6-execute/potential/potential.tsx b/frontend/src/pages/enhance/6-execute/potential/potential.tsx index 751959e..d27c62a 100644 --- a/frontend/src/pages/enhance/6-execute/potential/potential.tsx +++ b/frontend/src/pages/enhance/6-execute/potential/potential.tsx @@ -79,6 +79,7 @@ export default function Potential({ const addi = isAddi(materialType); const selectable = isSelectable(materialType); const options = getOptions(item, addi); + const optionsRef = useRef(options); const level = item.item_base_option.base_equipment_level; const grade = parseGrade( @@ -94,6 +95,9 @@ export default function Potential({ }); useEffect(() => () => clearInterval(intervalId), []); + useEffect(() => { + optionsRef.current = options; + }, [options]); useEffect(() => { gradeRef.current = grade; }, [grade]); @@ -137,6 +141,7 @@ export default function Potential({ } const grade = gradeRef.current; + const options = optionsRef.current; const guarantee = grade && guaranteesRef.current[materialType] ? guaranteesRef.current[materialType][grade] ?? 0