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 || '')
|
setPartyId(props.partyId || '')
|
||||||
setWeapons(props.weapons || {})
|
setWeapons(props.weapons || {})
|
||||||
setMainWeapon(props.mainhand)
|
setMainWeapon(props.mainhand)
|
||||||
|
if (props.mainhand) setElement(props.mainhand.weapon.element)
|
||||||
}, [props])
|
}, [props])
|
||||||
|
|
||||||
// Initialize an array of current uncap values for each weapon
|
// Initialize an array of current uncap values for each weapon
|
||||||
|
|
@ -81,10 +82,6 @@ const WeaponGrid = (props: Props) => {
|
||||||
setPreviousUncapValues(initialPreviousUncapValues)
|
setPreviousUncapValues(initialPreviousUncapValues)
|
||||||
}, [props])
|
}, [props])
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (mainWeapon) setElement(mainWeapon.weapon.element)
|
|
||||||
}, [mainWeapon])
|
|
||||||
|
|
||||||
// Update search grid whenever weapons or the mainhand are updated
|
// Update search grid whenever weapons or the mainhand are updated
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let newSearchGrid = Object.values(weapons).map((o) => o.weapon)
|
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) {
|
function receiveWeaponFromSearch(object: Character | Weapon | Summon, position: number) {
|
||||||
const weapon = object as Weapon
|
const weapon = object as Weapon
|
||||||
|
setElement(weapon.element)
|
||||||
|
|
||||||
if (!partyId) {
|
if (!partyId) {
|
||||||
props.createParty()
|
props.createParty()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue