fix: Object.values null safety + Docker dev build
Build and Publish Mana Loop Docker Image / build-and-publish (push) Has been cancelled
Build and Publish Mana Loop Docker Image / build-and-publish (push) Has been cancelled
- Change Dockerfile to use development build (better error messages)
- Add || {} fallbacks to all Object.values() calls accessing state
- Fixes "Cannot convert undefined or null to object" browser error during SSR/hydration
- Verified TypeScript compilation and Next.js build successful
Files modified:
- Dockerfile
- src/app/page.tsx
- src/components/game/tabs/StatsTab.tsx
- src/components/game/StatsTab/LoopStatsSection.tsx
- src/components/game/StatsTab/ElementStatsSection.tsx
- src/components/game/tabs/AttunementsTab.tsx
- src/components/game/tabs/GolemancyTab.tsx
- src/lib/game/effects.ts
- src/lib/game/utils/combat-utils.ts
- src/lib/game/crafting-loot.ts
- src/components/game/LootInventory/LootInventoryDisplay.tsx
- src/components/game/LootInventory/index.tsx
- src/components/game/crafting/EnchantmentDesigner/utils.ts
This commit is contained in:
@@ -28,7 +28,7 @@ export function getUniqueMaterialCount(inventory: LootInventory): number {
|
||||
|
||||
// Get total material stacks (sum of all quantities)
|
||||
export function getTotalMaterialStacks(inventory: LootInventory): number {
|
||||
return Object.values(inventory.materials).reduce((sum, qty) => sum + qty, 0);
|
||||
return Object.values(inventory.materials || {}).reduce((sum, qty) => sum + qty, 0);
|
||||
}
|
||||
|
||||
// ─── Inventory Modifications ────────────────────────────────────────────────
|
||||
@@ -265,7 +265,7 @@ export interface InventoryStats {
|
||||
|
||||
export function getInventoryStats(inventory: LootInventory): InventoryStats {
|
||||
const totalUniqueMaterials = Object.keys(inventory.materials).length;
|
||||
const totalMaterialStacks = Object.values(inventory.materials).reduce((sum, qty) => sum + qty, 0);
|
||||
const totalMaterialStacks = Object.values(inventory.materials || {}).reduce((sum, qty) => sum + qty, 0);
|
||||
const totalBlueprints = inventory.blueprints.length;
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user