Fix incorrect progress (#516)

This commit is contained in:
David Walker 2023-05-21 07:04:40 -07:00 committed by GitHub
parent 2e9dc32deb
commit 9d9f6b4dcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -97,11 +97,10 @@ interface SkillBarProps {
color?: string; color?: string;
} }
function SkillBar({ name, color }: SkillBarProps): React.ReactElement { function SkillBar({ name, color }: SkillBarProps): React.ReactElement {
const [mult, setMult] = useState(skillMultUpdaters[name]()); const [progress, setProgress] = useState(calculateSkillProgress(0));
const [progress, setProgress] = useState(calculateSkillProgress(Player.exp[skillNameMap[name]], mult));
useEffect(() => { useEffect(() => {
const clearSubscription = OverviewEventEmitter.subscribe(() => { const clearSubscription = OverviewEventEmitter.subscribe(() => {
setMult(skillMultUpdaters[name]()); const mult = skillMultUpdaters[name]();
setProgress(calculateSkillProgress(Player.exp[skillNameMap[name]], mult)); setProgress(calculateSkillProgress(Player.exp[skillNameMap[name]], mult));
}); });
return clearSubscription; return clearSubscription;