Reset values when the dialog is closed

The way we handle state means that we will keep old, unsaved values around if we don't do this
This commit is contained in:
Justin Edmund 2023-07-03 02:17:05 -07:00
parent 0b21bf768a
commit 15aa61731c
2 changed files with 13 additions and 2 deletions

View file

@ -249,6 +249,19 @@ const CharacterModal = ({
}
function close() {
setEarring({
modifier: gridCharacter.aetherial_mastery
? gridCharacter.aetherial_mastery.modifier
: 0,
strength: gridCharacter.aetherial_mastery
? gridCharacter.aetherial_mastery.strength
: 0,
})
setRings(gridCharacter.over_mastery || emptyExtendedMastery)
setAwakening(gridCharacter.awakening.type)
setAwakeningLevel(gridCharacter.awakening.level)
setAlertOpen(false)
setOpen(false)
onOpenChange(false)

View file

@ -133,7 +133,6 @@ const AwakeningSelectWithInput = ({
}
// Methods: Handle error
function handleInputError(value: number) {
let error = ''
@ -211,7 +210,6 @@ const AwakeningSelectWithInput = ({
max={maxLevel}
step="1"
onChange={handleInputChange}
visible={awakening ? 'true' : 'false'}
ref={inputRef}
/>
</div>