Skip to content

Commit

Permalink
Fix char card not updating when switching chars (#1354)
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyentvan7 authored and frzyc committed Dec 1, 2023
1 parent 4df6d1b commit 5c30865
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion apps/gi-frontend/src/app/Components/Character/CharacterCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
Skeleton,
Typography,
} from '@mui/material'
import { Suspense, useContext, useMemo, useState } from 'react'
import { Suspense, useContext, useEffect, useMemo, useState } from 'react'
import type { CalcContextObj } from '../../Context/CalcContext'
import { CalcContext } from '../../Context/CalcContext'
import { SillyContext } from '../../Context/SillyContext'
Expand Down Expand Up @@ -178,6 +178,45 @@ export default function CharacterCard({
),
])
)
useEffect(
() =>
setCalc(
genshinCalculatorWithEntries([
...teamData(['member0'], ['member0']),
...withMember(
'member0',
...charData({
key: characterKey,
level: 50,
ascension: 3,
constellation: 3,
talent: {
auto: 1,
skill: 1,
burst: 1,
},
}),
...weaponData({
key: 'KeyOfKhajNisut',
level: 50,
ascension: 3,
refinement: 1,
location: characterKey as LocationKey,
lock: false,
}),
...artifactsData([
// per art stat
]),
...conditionalData({
KeyOfKhajNisut: {
afterSkillStacks: 1,
},
})
),
])
),
[characterKey]
)
const calcContextObj = useMemo(
() => ({
calc,
Expand Down

0 comments on commit 5c30865

Please sign in to comment.