From 4ab187b991ec40993c4b030e1612d9bb41f18924 Mon Sep 17 00:00:00 2001 From: David Skoland Date: Sat, 7 Feb 2026 13:04:31 +0100 Subject: Defer char.ini loading and use direct img src for char icons Instead of eagerly fetching char_icon (with HEAD requests per extension) and char.ini for every character on join, set img.src directly to char_icon.png and defer char.ini loading until actually needed (character selection via handlePV, or first IC message via handleMS). This eliminates thousands of HTTP requests on join for large character lists. Co-Authored-By: Claude Opus 4.6 --- webAO/packets/handlers/handleMS.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'webAO/packets/handlers/handleMS.ts') diff --git a/webAO/packets/handlers/handleMS.ts b/webAO/packets/handlers/handleMS.ts index 2622fe6..9b46bc0 100644 --- a/webAO/packets/handlers/handleMS.ts +++ b/webAO/packets/handlers/handleMS.ts @@ -1,7 +1,7 @@ /* eslint indent: ["error", 2, { "SwitchCase": 1 }] */ import { client, extrafeatures, UPDATE_INTERVAL } from "../../client"; -import { handleCharacterInfo } from "../../client/handleCharacterInfo"; +import { handleCharacterInfo, ensureCharIni } from "../../client/handleCharacterInfo"; import { resetICParams } from "../../client/resetICParams"; import { prepChat, safeTags } from "../../encoding"; import { handle_ic_speaking } from "../../viewport/utils/handleICSpeaking"; @@ -27,6 +27,9 @@ export const handleMS = (args: string[]) => { ); const chargs = (`${char_name}&` + "iniediter").split("&"); handleCharacterInfo(chargs, char_id); + } else if (!client.chars[char_id].inifile) { + // Lazily load char.ini in background so future messages have proper data + ensureCharIni(char_id); } } -- cgit