Revert floating badge, remove debug logs
The floating version badge scrolled awkwardly and wasn't necessary now that the bind-mount/deploy issue is fixed. The existing ml-version inside the Sidebar is sufficient. Also removed the temporary [INV_DEBUG] console logs from useLiveData and InventoryWindow — the inventory live-update bug is confirmed fixed. Kept the per-character inventoryVersions fix and the cache-buster on the refetch URL. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
73e204c82b
commit
f7f04d6a84
18 changed files with 26 additions and 49 deletions
|
|
@ -71,7 +71,6 @@ export const MapLayout: React.FC<Props> = ({ data }) => {
|
|||
socket={data.socketRef.current} />
|
||||
<RareNotification recentRares={data.recentRares} />
|
||||
<DeathNotification deathAlerts={data.deathAlerts} />
|
||||
{version && <div className="ml-version-badge">v{version}</div>}
|
||||
</div>
|
||||
</WindowManagerProvider>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -181,17 +181,12 @@ export const InventoryWindow: React.FC<Props> = ({ id, charName, zIndex, invento
|
|||
|
||||
// Debounced re-fetch on inventory_delta (no loading flash)
|
||||
useEffect(() => {
|
||||
console.log('[INV_DEBUG] InventoryWindow effect', { charName, inventoryVersion, initialDone: initialLoadDone.current });
|
||||
if (!initialLoadDone.current || !inventoryVersion) return;
|
||||
clearTimeout(debounceRef.current);
|
||||
debounceRef.current = window.setTimeout(() => {
|
||||
console.log('[INV_DEBUG] debounce fired, fetching', charName);
|
||||
apiFetch<any>(`/inventory/${encodeURIComponent(charName)}?limit=1000&_t=${Date.now()}`)
|
||||
.then(inv => {
|
||||
console.log('[INV_DEBUG] fetch result', { char: charName, count: (inv.items ?? []).length });
|
||||
setItems((inv.items ?? []).map(normalizeItem));
|
||||
})
|
||||
.catch(err => console.log('[INV_DEBUG] fetch failed', err));
|
||||
.then(inv => setItems((inv.items ?? []).map(normalizeItem)))
|
||||
.catch(() => {});
|
||||
}, 2000); // 2s debounce — batch rapid deltas
|
||||
return () => clearTimeout(debounceRef.current);
|
||||
}, [charName, inventoryVersion]);
|
||||
|
|
|
|||
|
|
@ -75,14 +75,15 @@ export function useLiveData(): DashboardState {
|
|||
const r = msg as RareMessage;
|
||||
setRecentRares(prev => [r, ...prev].slice(0, 50));
|
||||
} else if (msg.type === 'inventory_delta') {
|
||||
const d = msg as unknown as { character_name: string; action?: string };
|
||||
console.log('[INV_DEBUG] inventory_delta received', { char: d.character_name, action: d.action });
|
||||
const d = msg as unknown as { character_name: string };
|
||||
// Bump ONLY this character's inventory version so an open window for
|
||||
// that character re-fetches. Deltas for other characters don't touch
|
||||
// it, which keeps the 2s debounce in InventoryWindow from being reset
|
||||
// forever by unrelated chatter.
|
||||
if (d.character_name) {
|
||||
setInventoryVersions(prev => {
|
||||
const next = new Map(prev);
|
||||
const newVer = (next.get(d.character_name) ?? 0) + 1;
|
||||
next.set(d.character_name, newVer);
|
||||
console.log('[INV_DEBUG] bumped version', { char: d.character_name, newVer });
|
||||
next.set(d.character_name, (next.get(d.character_name) ?? 0) + 1);
|
||||
return next;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -389,24 +389,6 @@
|
|||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
/* Floating version badge in the top-left of the viewport.
|
||||
Lets us verify at a glance which build is running. */
|
||||
.ml-version-badge {
|
||||
position: fixed;
|
||||
top: 4px;
|
||||
left: 4px;
|
||||
z-index: 10000;
|
||||
padding: 3px 8px;
|
||||
background: rgba(0, 0, 0, 0.75);
|
||||
border: 1px solid rgba(255, 200, 64, 0.5);
|
||||
border-radius: 4px;
|
||||
color: #ffcc44;
|
||||
font-family: monospace;
|
||||
font-size: 0.7rem;
|
||||
pointer-events: none;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
/* ── Tooltip ──────────────────────────────────────────── */
|
||||
.ml-tooltip {
|
||||
position: absolute;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue