perf: lazy load authenticated office peers
This commit is contained in:
+6
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user