Skip to content

Commit

Permalink
release works correctly for in-save pokemon
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbenington committed Dec 17, 2024
1 parent b6a7a19 commit 4ac178a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/dev/AppStateDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function AppStateDisplay() {
<Card sx={{ margin: 1 }}>
<InfoGrid data={appState ?? {}} />
</Card>
<Card>
<Card style={{ display: 'flex', flexDirection: 'row' }}>
<DevDataDisplay data={appInfoState} label="App Info State" />
<DevDataDisplay data={openSavesState} label="Saves/Mons State" />
</Card>
Expand Down
6 changes: 4 additions & 2 deletions src/state/openSaves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,16 @@ export const openSavesReducer: Reducer<OpenSavesState, OpenSavesAction> = (
case 'add_mon_to_release': {
const replacedMon = updateMonInSave(state, undefined, action.payload)

if (replacedMon && replacedMon instanceof OHPKM) {
if (!replacedMon) return { ...state }

if (replacedMon instanceof OHPKM) {
const identifier = getMonFileIdentifier(replacedMon)

if (identifier) {
delete state.modifiedOHPKMs[identifier]
}
state.monsToRelease.push(replacedMon)
}
state.monsToRelease.push(replacedMon)
return { ...state }
}
case 'clear_updated_box_slots': {
Expand Down

0 comments on commit 4ac178a

Please sign in to comment.