diff --git a/components/WeaponGrid/index.tsx b/components/WeaponGrid/index.tsx index c1e05f8f..d18f877d 100644 --- a/components/WeaponGrid/index.tsx +++ b/components/WeaponGrid/index.tsx @@ -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()