fix: add error logging, missing persist fields, and version to store configs
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m25s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m25s
- safe-persist.ts: add console.error logging to setItem catch block (was silently swallowing all errors) - manaStore.ts: add meditateTicks to partialize (was lost on refresh) - combatStore.ts: add currentAction, currentRoom, comboHitCount, floorHitCount, totalSpellsCast, totalDamageDealt, totalCraftsCompleted to partialize - All 8 stores: add version: 1 to persist configs for future schema migration safety Fixes #147
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# Circular Dependencies
|
# Circular Dependencies
|
||||||
Generated: 2026-05-26T19:57:33.588Z
|
Generated: 2026-05-26T19:57:56.106Z
|
||||||
|
|
||||||
No circular dependencies found. ✅
|
No circular dependencies found. ✅
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"generated": "2026-05-26T19:57:31.715Z",
|
"generated": "2026-05-26T19:57:54.313Z",
|
||||||
"description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.",
|
"description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.",
|
||||||
"usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry."
|
"usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry."
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ export const useAttunementStore = create<AttunementStoreState>()(
|
|||||||
{
|
{
|
||||||
storage: createSafeStorage(),
|
storage: createSafeStorage(),
|
||||||
name: 'mana-loop-attunements',
|
name: 'mana-loop-attunements',
|
||||||
|
version: 1,
|
||||||
partialize: (state) => ({
|
partialize: (state) => ({
|
||||||
attunements: state.attunements,
|
attunements: state.attunements,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -307,20 +307,28 @@ export const useCombatStore = create<CombatStore>()(
|
|||||||
{
|
{
|
||||||
storage: createSafeStorage(),
|
storage: createSafeStorage(),
|
||||||
name: 'mana-loop-combat',
|
name: 'mana-loop-combat',
|
||||||
|
version: 1,
|
||||||
partialize: (state) => ({
|
partialize: (state) => ({
|
||||||
currentFloor: state.currentFloor,
|
currentFloor: state.currentFloor,
|
||||||
maxFloorReached: state.maxFloorReached,
|
maxFloorReached: state.maxFloorReached,
|
||||||
spells: state.spells,
|
spells: state.spells,
|
||||||
activeSpell: state.activeSpell,
|
activeSpell: state.activeSpell,
|
||||||
|
currentAction: state.currentAction,
|
||||||
floorHP: state.floorHP,
|
floorHP: state.floorHP,
|
||||||
floorMaxHP: state.floorMaxHP,
|
floorMaxHP: state.floorMaxHP,
|
||||||
castProgress: state.castProgress,
|
castProgress: state.castProgress,
|
||||||
spireMode: state.spireMode,
|
spireMode: state.spireMode,
|
||||||
|
currentRoom: state.currentRoom,
|
||||||
clearedFloors: state.clearedFloors,
|
clearedFloors: state.clearedFloors,
|
||||||
golemancy: state.golemancy,
|
golemancy: state.golemancy,
|
||||||
equipmentSpellStates: state.equipmentSpellStates,
|
equipmentSpellStates: state.equipmentSpellStates,
|
||||||
|
comboHitCount: state.comboHitCount,
|
||||||
|
floorHitCount: state.floorHitCount,
|
||||||
activityLog: state.activityLog,
|
activityLog: state.activityLog,
|
||||||
achievements: state.achievements,
|
achievements: state.achievements,
|
||||||
|
totalSpellsCast: state.totalSpellsCast,
|
||||||
|
totalDamageDealt: state.totalDamageDealt,
|
||||||
|
totalCraftsCompleted: state.totalCraftsCompleted,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -356,6 +356,7 @@ export const useCraftingStore = create<CraftingStore>()(
|
|||||||
{
|
{
|
||||||
storage: createSafeStorage(),
|
storage: createSafeStorage(),
|
||||||
name: 'mana-loop-crafting',
|
name: 'mana-loop-crafting',
|
||||||
|
version: 1,
|
||||||
partialize: (state) => ({
|
partialize: (state) => ({
|
||||||
designProgress: state.designProgress,
|
designProgress: state.designProgress,
|
||||||
designProgress2: state.designProgress2,
|
designProgress2: state.designProgress2,
|
||||||
|
|||||||
@@ -216,6 +216,6 @@ export const useDisciplineStore = create<DisciplineStore>()(
|
|||||||
return { rawMana, elements, unlockedEffects: newUnlockedEffects };
|
return { rawMana, elements, unlockedEffects: newUnlockedEffects };
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{ storage: createSafeStorage(), name: 'mana-loop-discipline-store', partialize: (state) => ({ disciplines: state.disciplines, activeIds: state.activeIds, concurrentLimit: state.concurrentLimit, totalXP: state.totalXP, processedPerks: state.processedPerks }) }
|
{ storage: createSafeStorage(), name: 'mana-loop-discipline-store', version: 1, partialize: (state) => ({ disciplines: state.disciplines, activeIds: state.activeIds, concurrentLimit: state.concurrentLimit, totalXP: state.totalXP, processedPerks: state.processedPerks }) }
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -386,6 +386,7 @@ export const useGameStore = create<GameCoordinatorStore>()(
|
|||||||
{
|
{
|
||||||
storage: createSafeStorage(),
|
storage: createSafeStorage(),
|
||||||
name: 'mana-loop-game-storage',
|
name: 'mana-loop-game-storage',
|
||||||
|
version: 1,
|
||||||
partialize: (state) => ({
|
partialize: (state) => ({
|
||||||
day: state.day,
|
day: state.day,
|
||||||
hour: state.hour,
|
hour: state.hour,
|
||||||
|
|||||||
@@ -205,7 +205,8 @@ export const useManaStore = create<ManaStore>()(
|
|||||||
{
|
{
|
||||||
storage: createSafeStorage(),
|
storage: createSafeStorage(),
|
||||||
name: 'mana-loop-mana',
|
name: 'mana-loop-mana',
|
||||||
partialize: (state) => ({ rawMana: state.rawMana, totalManaGathered: state.totalManaGathered, elements: state.elements }),
|
version: 1,
|
||||||
|
partialize: (state) => ({ rawMana: state.rawMana, meditateTicks: state.meditateTicks, totalManaGathered: state.totalManaGathered, elements: state.elements }),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -273,6 +273,7 @@ export const usePrestigeStore = create<PrestigeStore>()(
|
|||||||
{
|
{
|
||||||
storage: createSafeStorage(),
|
storage: createSafeStorage(),
|
||||||
name: 'mana-loop-prestige',
|
name: 'mana-loop-prestige',
|
||||||
|
version: 1,
|
||||||
partialize: (state) => ({
|
partialize: (state) => ({
|
||||||
loopCount: state.loopCount,
|
loopCount: state.loopCount,
|
||||||
insight: state.insight,
|
insight: state.insight,
|
||||||
|
|||||||
@@ -66,6 +66,6 @@ export const useUIStore = create<UIState>()(
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{ storage: createSafeStorage(), name: 'mana-loop-ui-storage', partialize: (state) => ({ logs: state.logs, paused: state.paused, gameOver: state.gameOver, victory: state.victory }) }
|
{ storage: createSafeStorage(), name: 'mana-loop-ui-storage', version: 1, partialize: (state) => ({ logs: state.logs, paused: state.paused, gameOver: state.gameOver, victory: state.victory }) }
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export function createSafeStorage(): any {
|
|||||||
try {
|
try {
|
||||||
localStorage.setItem(name, JSON.stringify(value));
|
localStorage.setItem(name, JSON.stringify(value));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('[safe-persist] Failed to persist:', name, error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
removeItem: (name: string): void => {
|
removeItem: (name: string): void => {
|
||||||
|
|||||||
Reference in New Issue
Block a user