1
0

perf: lazy load authenticated office peers

This commit is contained in:
2026-08-11 20:29:06 -07:00
parent 92ebf8abb5
commit fc1f500019
2 changed files with 21 additions and 7 deletions
+6 -1
View File
@@ -1180,6 +1180,11 @@ async function enterOffice() {
if (!built || !city) return;
const { createOfficeScene, createOfficeMinimap, pack, materials } = built;
const depth = access.can.officeDepth;
// Keep the remote-avatar renderer behind the authenticated boundary. The
// public Office door can build its full local scene without downloading it.
const createOfficePeers = access.subject !== null
? (await import("./realtime/scenePeers.ts")).createScenePeers
: null;
/**
* The building's own sky, built before the scene because the scene wants the
@@ -1252,7 +1257,7 @@ async function enterOffice() {
...(depth === "full"
? { onPresencePick: (p) => showDetail(p ? p.label : null) }
: { onPlacePick: (place) => showDetail(place ? place.label : null) }),
...(access.subject !== null ? { realtimePeers: {} } : {}),
...(createOfficePeers ? { realtimePeers: { create: createOfficePeers } } : {}),
});
office.onViewChange(() => renderLegend());
officePlan = buildOfficePlan(createOfficeMinimap, office);