Stop sharing a Data Library entry as on once its failed Remove switched it off

When Remove switched a layer off and then its destroy failed, the
manager published no visibility change, so the selection still listed
the entry as on: the link shared it as on and a reload restored it on
while its row read off. A failed Remove now drops the entry from what is
on and remembered whenever its layer ended up off.
This commit is contained in:
Sameh Khamis committed 2026-11-12 17:49:38 -08:00
1 parent 837eff7328
commit 8cca78bcd5
2 files changed
+47 -1

No files matched your search

+12 -1
View File
@@ -388,8 +388,19 @@ export function createDataLibrary({
if (
isRegistered(id) &&
!(await dataManager.unregisterLibraryLayer(libraryLayerId(id)))
)
) {
// Switched off before teardown failed: it is no longer on, so the
// link and what is remembered must not say it is.
if (!dataManager.isEnabled?.(libraryLayerId(id))) {
selection = {
...selection,
on: selection.on.filter((other) => other !== id),
};
savedOn = savedOn.filter((other) => other !== id);
persist();
}
return false;
}
selection = {
added: selection.added.filter((other) => other !== id),
on: selection.on.filter((other) => other !== id),