Skip to content

Commit

Permalink
fix: reference updated materials of new grade
Browse files Browse the repository at this point in the history
  • Loading branch information
geoje committed Nov 6, 2024
1 parent 220bbfe commit 43cfb46
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 @@ -88,6 +88,7 @@ export default function Potential({
);
const gradeRef = useRef(grade);
const costMaterials = calcRollingMaterials(materialType, level, addi, grade);
const costMaterialsRef = useRef(costMaterials);

const { data, isFetching } = usePotentialQuery({
type: MATERIAL_INFOS[materialType].type,
Expand All @@ -108,6 +109,9 @@ export default function Potential({
useEffect(() => {
guaranteesRef.current = guarantees;
}, [guarantees]);
useEffect(() => {
costMaterialsRef.current = costMaterials;
}, [costMaterials]);

useEffect(() => {
clearNewOptions();
Expand Down Expand Up @@ -145,6 +149,7 @@ export default function Potential({
}

const grade = gradeRef.current;
const costMaterials = costMaterialsRef.current;
const options = selectable
? newOptionsRef.current.map((option) =>
option.name.replace("n", option.value.toString())
Expand Down

0 comments on commit 43cfb46

Please sign in to comment.