debug(v2): add earlier console.log to trace inventory fetch

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-12 22:22:15 +02:00
parent 87598e0952
commit a2f77e1061
3 changed files with 8 additions and 4 deletions

View file

@ -166,13 +166,17 @@ export const InventoryWindow: React.FC<Props> = ({ id, charName, zIndex }) => {
const [cantripState, setCantripState] = useState<any>(null); const [cantripState, setCantripState] = useState<any>(null);
useEffect(() => { useEffect(() => {
console.log('[INV] Loading inventory for', charName);
setLoading(true); setLoading(true);
Promise.all([ Promise.all([
apiFetch<any>(`/inventory/${encodeURIComponent(charName)}?limit=1000`).catch(() => ({ items: [] })), apiFetch<any>(`/inventory/${encodeURIComponent(charName)}?limit=1000`).catch(e => { console.error('[INV] fetch error:', e); return { items: [] }; }),
apiFetch<any>(`/character-stats/${encodeURIComponent(charName)}`).catch(() => null), apiFetch<any>(`/character-stats/${encodeURIComponent(charName)}`).catch(() => null),
]).then(([inv, stats]) => { ]).then(([inv, stats]) => {
const rawItems = inv.items ?? []; const rawItems = inv.items ?? [];
setItems(rawItems.map(normalizeItem)); console.log('[INV] Got', rawItems.length, 'raw items, first:', rawItems[0]);
const normalized = rawItems.map(normalizeItem);
console.log('[INV] Normalized', normalized.length, 'items, sample container_ids:', normalized.slice(0, 5).map((i: any) => i.container_id));
setItems(normalized);
setCharStats(stats); setCharStats(stats);
}).finally(() => setLoading(false)); }).finally(() => setLoading(false));
}, [charName]); }, [charName]);

File diff suppressed because one or more lines are too long

View file

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Mosswart Overlord v2</title> <title>Mosswart Overlord v2</title>
<link rel="icon" type="image/png" href="/icons/7735.png" /> <link rel="icon" type="image/png" href="/icons/7735.png" />
<script type="module" crossorigin src="/v2/assets/index-SyvbSo1H.js"></script> <script type="module" crossorigin src="/v2/assets/index-Belkz_Ci.js"></script>
<link rel="stylesheet" crossorigin href="/v2/assets/index-DrsM2PEe.css"> <link rel="stylesheet" crossorigin href="/v2/assets/index-DrsM2PEe.css">
</head> </head>
<body> <body>