fix: guard localStorage for SSR, fix currentAction written to wrong store
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m5s

This commit is contained in:
Refactoring Agent
2026-05-06 09:45:28 +02:00
parent b0cc848909
commit fe2d1f6bc6
2 changed files with 15 additions and 12 deletions
+7 -6
View File
@@ -15,6 +15,7 @@ import { hasSpecial, SPECIAL_EFFECTS } from '../special-effects';
// Import other stores to access required state
import { useSkillStore } from './skillStore';
import { useGameStore } from './gameStore';
import { useCombatStore } from './combatStore';
// Import action modules
import * as ApplicationActions from '../crafting-actions/application-actions';
@@ -140,8 +141,8 @@ export const useCraftingStore = create<CraftingStore>()(
effects,
},
};
// Update currentAction in gameStore
useGameStore.setState({ currentAction: 'design' });
// Update currentAction in combatStore
useCombatStore.setState({ currentAction: 'design' });
} else if (hasEnchantMastery && !state.designProgress2) {
updates = {
designProgress2: {
@@ -167,7 +168,7 @@ export const useCraftingStore = create<CraftingStore>()(
set({ designProgress2: null });
} else {
set({ designProgress: null });
useGameStore.setState({ currentAction: 'meditate' });
useCombatStore.setState({ currentAction: 'meditate' });
}
},
@@ -189,8 +190,8 @@ export const useCraftingStore = create<CraftingStore>()(
set((s) => ({
enchantmentDesigns: [...s.enchantmentDesigns, design],
designProgress: null,
currentAction: 'meditate' as const,
}));
useCombatStore.setState({ currentAction: 'meditate' });
}
},
@@ -214,7 +215,7 @@ export const useCraftingStore = create<CraftingStore>()(
cancelApplication: () => {
ApplicationActions.cancelApplication(set);
useGameStore.setState({ currentAction: 'meditate' });
useCombatStore.setState({ currentAction: 'meditate' });
},
// Preparation actions
@@ -232,7 +233,7 @@ export const useCraftingStore = create<CraftingStore>()(
cancelPreparation: () => {
PreparationActions.cancelPreparation(set);
useGameStore.setState({ currentAction: 'meditate' });
useCombatStore.setState({ currentAction: 'meditate' });
},
// Loot inventory actions
+2
View File
@@ -8,12 +8,14 @@ import { useCombatStore } from './combatStore';
export const createResetGame = (set: (state: any) => void, initialState: any) => () => {
// Clear all persisted state
if (typeof window !== 'undefined') {
localStorage.removeItem('mana-loop-ui-storage');
localStorage.removeItem('mana-loop-prestige-storage');
localStorage.removeItem('mana-loop-mana-storage');
localStorage.removeItem('mana-loop-skill-storage');
localStorage.removeItem('mana-loop-combat-storage');
localStorage.removeItem('mana-loop-game-storage');
}
const startFloor = 1;