Skip to content

Commit 4a21a77

Browse files
committed
web: rebuild selectableLayers from scratch in layer onChange
The layerSelModel callback was add/delete-ing names incrementally, so in multi-chiplet / multi-tech designs where the same layer name appears in multiple subtrees the final state of app.selectableLayers depended on traversal order — an unchecked M1 leaf could delete the name even when another M1 leaf was still checked, dropping it from the wire payload's selectable_layers. Mirror the visibility callback's pattern: clear() the Set in place (WebSocketTileLayer holds the reference) and re-add only checked nodes' names so Set semantics handle duplicates correctly. Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
1 parent 1450298 commit 4a21a77

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/web/src/display-controls.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,15 @@ export function populateDisplayControls(app, visibility, selectability,
327327

328328
// Parallel selectability model — picks gate on this set on the server.
329329
const layerSelModel = new CheckboxTreeModel(() => {
330+
// Rebuild from scratch so multi-chiplet/multi-tech subtrees that
331+
// share a layer name don't fall into last-writer-wins (an unchecked
332+
// M1 leaf in one subtree would otherwise delete the name even when
333+
// another M1 leaf is still checked). Mutate in place — the
334+
// WebSocketTileLayer closure captured this Set by reference.
335+
app.selectableLayers.clear();
330336
layerSelModel.forEach(node => {
331-
if (!node.data) return;
332-
if (node.data.name) {
333-
if (node.checked) {
334-
app.selectableLayers.add(node.data.name);
335-
} else {
336-
app.selectableLayers.delete(node.data.name);
337-
}
337+
if (node.checked && node.data && node.data.name) {
338+
app.selectableLayers.add(node.data.name);
338339
}
339340
});
340341
syncLayerSelDom();

0 commit comments

Comments
 (0)