Update the element when the weapon swaps
This is still broken, we have to rewrite some API calls to fix it.
This commit is contained in:
parent
a21a66c8ae
commit
5d27509148
1 changed files with 2 additions and 4 deletions
|
|
@ -71,6 +71,7 @@ const WeaponGrid = (props: Props) => {
|
|||
setPartyId(props.partyId || '')
|
||||
setWeapons(props.weapons || {})
|
||||
setMainWeapon(props.mainhand)
|
||||
if (props.mainhand) setElement(props.mainhand.weapon.element)
|
||||
}, [props])
|
||||
|
||||
// Initialize an array of current uncap values for each weapon
|
||||
|
|
@ -81,10 +82,6 @@ const WeaponGrid = (props: Props) => {
|
|||
setPreviousUncapValues(initialPreviousUncapValues)
|
||||
}, [props])
|
||||
|
||||
useEffect(() => {
|
||||
if (mainWeapon) setElement(mainWeapon.weapon.element)
|
||||
}, [mainWeapon])
|
||||
|
||||
// Update search grid whenever weapons or the mainhand are updated
|
||||
useEffect(() => {
|
||||
let newSearchGrid = Object.values(weapons).map((o) => o.weapon)
|
||||
|
|
@ -103,6 +100,7 @@ const WeaponGrid = (props: Props) => {
|
|||
|
||||
function receiveWeaponFromSearch(object: Character | Weapon | Summon, position: number) {
|
||||
const weapon = object as Weapon
|
||||
setElement(weapon.element)
|
||||
|
||||
if (!partyId) {
|
||||
props.createParty()
|
||||
|
|
|
|||
Loading…
Reference in a new issue