Document which inputs a warm cached renderer keeps from the application that built it

This commit is contained in:
German Khokhlov committed 2026-11-03 14:47:36 +04:00
1 parent 64759c552e
commit 64c5cd25e6
1 file changed
+11 -2
+11 -2
View File
@@ -32,7 +32,9 @@ export async function createApplicationScene({
layerSession, layerSession,
...options ...options
}) { }) {
const operations = layerSession?.operations ?? createApplicationOperations({ const operations =
layerSession?.operations ??
createApplicationOperations({
requests: requestServices, requests: requestServices,
signal: layerSession?.lifetime.signal ?? signal, signal: layerSession?.lifetime.signal ?? signal,
}); });
@@ -47,6 +49,12 @@ export async function createApplicationScene({
else window.__GOOGLE_MAPS_API_KEY__ = previousKey; else window.__GOOGLE_MAPS_API_KEY__ = previousKey;
}); });
} }
// A cached renderer is built once, by the first application that asks for
// its engine, and later applications reuse it warm. Everything this closure
// captures from that application (its abort signal, the loader status
// element, Navara's `?look=` read from location.search) is read only while
// the renderer is being built; nothing in the built scene keeps using it.
// A changed `?look=` therefore applies to a renderer built after it.
const build = (resources) => const build = (resources) =>
createRenderer({ createRenderer({
...options, ...options,
@@ -54,7 +62,8 @@ export async function createApplicationScene({
signal, signal,
...resources, ...resources,
}); });
const { viewer, engine, tileset, mapStackController, packRenderer } = rendererCache const { viewer, engine, tileset, mapStackController, packRenderer } =
rendererCache
? await rendererCache.acquire(options.engineKind, build, defer) ? await rendererCache.acquire(options.engineKind, build, defer)
: await build({ defer }); : await build({ defer });
if (layerSession) { if (layerSession) {