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:
parent
87598e0952
commit
a2f77e1061
3 changed files with 8 additions and 4 deletions
|
|
@ -166,13 +166,17 @@ export const InventoryWindow: React.FC<Props> = ({ id, charName, zIndex }) => {
|
|||
const [cantripState, setCantripState] = useState<any>(null);
|
||||
|
||||
useEffect(() => {
|
||||
console.log('[INV] Loading inventory for', charName);
|
||||
setLoading(true);
|
||||
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),
|
||||
]).then(([inv, stats]) => {
|
||||
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);
|
||||
}).finally(() => setLoading(false));
|
||||
}, [charName]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue