Keep Contacts, active layer intents and mapped sites across globe switches

This commit is contained in:
German Khokhlov committed 2026-11-03 03:05:47 +04:00
1 parent 81bcae907f
commit 87bbe14748
35 files changed
+465 -118

No files matched your search

+6 -1
View File
@@ -147,12 +147,16 @@ export class LayerLifecycle {
this.viewer = viewer;
this.engine = engine ?? engineFromViewer(viewer) ?? null;
this._catalogSourceAvailability = catalog.getSourceAvailability;
const attachments = [];
for (const layer of catalog.layers) {
const entry = this.layers.get(layer.id);
if (!entry) this.register(layer);
else {
if (entry.module !== layer) throw new Error(`Layer owner changed: ${layer.id}`);
if (entry.initialized) layer.attachRenderer(viewer, this._moduleContext());
if (entry.initialized) {
const ready = layer.attachRenderer(viewer, this._moduleContext());
if (ready?.then) attachments.push(ready);
}
}
}
// Retained entries may appear anywhere in the directory. Preserve both
@@ -163,6 +167,7 @@ export class LayerLifecycle {
this.layers.set(id, entry);
}
this.finalizeRegistrations(catalog.metadata);
if (attachments.length) return Promise.all(attachments);
}
/** Register a synthetic layer after sealing in an explicitly dev-enabled manager. */