mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Suspend only the layers Context isolation is switching off
The session snapshot recorded a user's switch only after the CCTV panel had already rendered the layer off, so a first switch-off by the user inside Contacts, or after a partly failed restore, still kept the panel open. Context controls now hold the layers _clearLayersOutsideContextMode is switching off while its transitions run; suspendsLayer reads that set, and the snapshot is no longer consulted.
This commit is contained in:
1 parent
f0ee1b95ca
commit
9b46692c64
6 files changed
+50
-63
No files matched your search
@@ -240,25 +240,35 @@ export async function _clearLayersOutsideContextMode(
|
||||
) {
|
||||
const allowed = contextAllowedLayerIds(mode);
|
||||
const pending = [];
|
||||
for (const [layerId] of this._dataManager.layers || []) {
|
||||
// Effective visibility: a disallowed layer still mid-ENABLING must be
|
||||
// isolated too, or it settles ON inside the exclusive mode.
|
||||
if (
|
||||
!allowed.has(layerId) &&
|
||||
this._dataManager.isEffectivelyEnabled(layerId)
|
||||
) {
|
||||
pending.push({
|
||||
layerId,
|
||||
transition: this._dataManager.setEnabled(layerId, false, {
|
||||
notificationToken,
|
||||
...(signal ? { signal } : {}),
|
||||
}),
|
||||
});
|
||||
// Panels read this while their layer goes off (suspendsLayer): a layer
|
||||
// isolation switches off is suspended, not switched off by the user.
|
||||
const isolating = [];
|
||||
let results;
|
||||
try {
|
||||
for (const [layerId] of this._dataManager.layers || []) {
|
||||
// Effective visibility: a disallowed layer still mid-ENABLING must be
|
||||
// isolated too, or it settles ON inside the exclusive mode.
|
||||
if (
|
||||
!allowed.has(layerId) &&
|
||||
this._dataManager.isEffectivelyEnabled(layerId)
|
||||
) {
|
||||
if (!this._isolatingLayerIds.has(layerId)) {
|
||||
this._isolatingLayerIds.add(layerId);
|
||||
isolating.push(layerId);
|
||||
}
|
||||
pending.push({
|
||||
layerId,
|
||||
transition: this._dataManager.setEnabled(layerId, false, {
|
||||
notificationToken,
|
||||
...(signal ? { signal } : {}),
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
results = await Promise.all(pending.map(({ transition }) => transition));
|
||||
} finally {
|
||||
for (const layerId of isolating) this._isolatingLayerIds.delete(layerId);
|
||||
}
|
||||
const results = await Promise.all(
|
||||
pending.map(({ transition }) => transition),
|
||||
);
|
||||
const failed = pending
|
||||
.filter(
|
||||
({ layerId }, index) =>
|
||||
|
||||
Reference in new issue
Block a user