fix(store): preserve non-mapping native layer entries (#508)

* fix(store): preserve non-mapping native layer entries

* test(store): cover mixed native injection cleanup
This commit is contained in:
Sylvester Kaczmarek
2026-08-14 18:30:08 -06:00
committed by GitHub
parent b6516a21bf
commit d595f2a698
2 changed files with 56 additions and 2 deletions
+10 -2
View File
@@ -141,7 +141,11 @@ def inject_layer_data(
existing = list(current) if isinstance(current, list) else []
if mode == "replace":
existing = [e for e in existing if not e.get("_injected")]
existing = [
entry
for entry in existing
if not (isinstance(entry, dict) and entry.get("_injected"))
]
# Readers can hold references to published layer lists after releasing
# _data_lock. Build a fresh list and swap it atomically rather than
@@ -170,7 +174,11 @@ def clear_injected_data(layer: str = "") -> dict[str, Any]:
if not isinstance(existing, list):
continue
before = len(existing)
latest_data[lyr] = [e for e in existing if not e.get("_injected")]
latest_data[lyr] = [
entry
for entry in existing
if not (isinstance(entry, dict) and entry.get("_injected"))
]
removed += before - len(latest_data[lyr])
if removed: