File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/components/rulebookSpecific/sotww Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11import styled from '@emotion/styled' ;
22import { trim } from 'lodash' ;
3- import { useContext } from 'react' ;
3+ import { useContext , useEffect } from 'react' ;
44import { useFormContext } from 'react-hook-form' ;
55
66import { FlexBox } from '~/components/box/FlexBox' ;
@@ -17,7 +17,7 @@ const LongEffect = styled(Text)`
1717
1818export function QuickAccess ( ) {
1919 const { watch } = useFormContext < SotwwCharacterData > ( ) ;
20- const { totalDefense } = useContext ( DefenseContext ) ;
20+ const { totalDefense, recalculateDefense } = useContext ( DefenseContext ) ;
2121
2222 const equippedWeapon = watch ( 'weapons' ) . find ( ( w ) => w . weapon_equipped ) ;
2323 const weaponText = equippedWeapon
@@ -30,6 +30,10 @@ export function QuickAccess() {
3030 const conditions = watch ( 'conditions' ) ;
3131 const boonBane = watch ( 'boons_and_banes' ) ;
3232
33+ useEffect ( ( ) => {
34+ recalculateDefense ( ) ;
35+ } , [ recalculateDefense ] ) ;
36+
3337 return (
3438 < FormSection
3539 borderColor = "primary"
You can’t perform that action at this time.
0 commit comments