Skip to content

Commit

Permalink
fix: forget previous options on auto
Browse files Browse the repository at this point in the history
  • Loading branch information
geoje committed Nov 5, 2024
1 parent 4dbdceb commit 60db0cc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/src/pages/enhance/6-execute/potential/potential.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -94,6 +95,9 @@ export default function Potential({
});

useEffect(() => () => clearInterval(intervalId), []);
useEffect(() => {
optionsRef.current = options;
}, [options]);
useEffect(() => {
gradeRef.current = grade;
}, [grade]);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 60db0cc

Please sign in to comment.