diff --git a/apps/web/src/hooks/use-encounter.ts b/apps/web/src/hooks/use-encounter.ts index c640cb1..5de527b 100644 --- a/apps/web/src/hooks/use-encounter.ts +++ b/apps/web/src/hooks/use-encounter.ts @@ -328,7 +328,10 @@ export function useEncounter() { creatureId: cId, }); - if (isDomainError(result)) return null; + if (isDomainError(result)) { + store.save(snapshot); + return null; + } const newState = pushUndo(undoRedoRef.current, snapshot); undoRedoRef.current = newState; @@ -363,7 +366,10 @@ export function useEncounter() { playerCharacterId: pc.id, }); - if (isDomainError(result)) return; + if (isDomainError(result)) { + store.save(snapshot); + return; + } const newState = pushUndo(undoRedoRef.current, snapshot); undoRedoRef.current = newState;