From 2525087657f2661ae81d12cc31799486a997f3d3 Mon Sep 17 00:00:00 2001 From: ApocDev Date: Wed, 1 Jul 2026 09:52:13 -0400 Subject: [PATCH] fix(app): return an empty icon manifest before the first data sync MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit iconManifestFn read manifest.json unconditionally, so a fresh install (no atlas yet) surfaced an ENOENT to the client on every launch. Return an empty manifest instead — icons fall back gracefully until a data sync builds the atlas. --- app/src/server/factorio.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/server/factorio.ts b/app/src/server/factorio.ts index aaf84dd..2180469 100644 --- a/app/src/server/factorio.ts +++ b/app/src/server/factorio.ts @@ -1875,7 +1875,14 @@ export const iconManifestFn = createServerFn({ method: "GET" }).handler( const fs = await import("node:fs/promises"); const path = await import("node:path"); const { ICON_DATA_DIR } = await import("./paths.ts"); - const raw = await fs.readFile(path.join(ICON_DATA_DIR, "manifest.json"), "utf8"); + let raw: string; + try { + raw = await fs.readFile(path.join(ICON_DATA_DIR, "manifest.json"), "utf8"); + } catch { + // No atlas yet (a fresh install, before the first data sync) — return an empty + // manifest so icons fall back gracefully instead of surfacing an ENOENT. + return { cell: 0, atlasSize: 0, sheets: [], icons: {} }; + } // file content is untyped input — assert the shape at this boundary only const manifest = JSON.parse(raw) as IconManifest; // Cache-bust the atlas sheets: the PNGs are served at stable URLs (/icons/