fix(layers): make Clear All clear the saved and shared layer selection (#1417)

* fix(layers): make Clear All clear the saved and shared layer selection

After Clear All every layer control was off, but the share URL could keep
listing layers (for example l=e.f) and a reload switched them back on.

The URL and local preferences are written from the committed layer
state, which only explicit visibility changes update. Clear All issued an
explicit OFF only for layers it found on at the start of the batch and
whose turn was not superseded. A layer already off for a passive reason
(isolated by Contacts or another context mode, or released by Contacts'
own teardown while the batch ran) never received one, so it stayed in the
committed state. Clear All also discards the context snapshot that would
have restored those layers, leaving the screen and the URL out of step.

Clear All now publishes the set of layers still on once its batch
settles, and the layer-state coordinator commits that selection: every
saved layer not in it is dropped and its passive restore is cancelled,
while a layer a newer explicit request turned back on is kept. A context
restore interrupted by Clear All no longer brings its snapshot back after
Contacts settles.

* docs: changelog for #1417
This commit is contained in:
Sameh Khamis authored and GitHub committed 2026-10-26 14:07:58 -07:00
1 parent b7ece1d4d1
commit fefd5cdcf1
6 files changed
+180

No files matched your search

+3
View File
@@ -86,6 +86,9 @@ export async function _restoreContextSession({
throw error;
}
}
// Clear All may have run while Contacts settled. It owns the selection
// now, so the snapshot must not come back behind it.
if (restoreState.cancelled) return;
await this._dataManager.restoreEnabledLayerIds(
restoreState.enabledLayerIds,
{