mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-13 18:46:37 +00:00
fix(web): keep layout-leaf style-editor columns distinct from name collisions
columnsFor() keyed a layout-only leaf field's column by its bare field
name. If an unrelated element's style block or another element's layout
axis block happened to declare a sub-field with that same name, the
`!seen.has(key)` guard skipped creating the leaf's column, silently
dropping its only control again -- the same failure the leaf-column fix
was meant to close, just reached through a name collision (CodeRabbit
review on 324a7ea).
Key layout-leaf columns under a namespaced id so they can never be
shadowed by an unrelated column sharing their name.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -403,12 +403,18 @@
|
||||
if (layoutEntry && typeof layoutEntry === 'object' && layoutEntry.properties) {
|
||||
Object.keys(layoutEntry.properties).forEach(
|
||||
function (f) { seen.set(f, 'layout'); });
|
||||
} else if (layoutEntry && !seen.has(key)) {
|
||||
} else if (layoutEntry) {
|
||||
// layout-only and a leaf: nothing else will share this
|
||||
// column, but leaving it out drops the field's only control
|
||||
// the moment the wholesale `layout` claim removes its
|
||||
// fallback (#569 review).
|
||||
seen.set(key, 'layout-leaf');
|
||||
// fallback (#569 review). Keyed under a namespaced id, not
|
||||
// the bare field name -- an unrelated element's own style
|
||||
// sub-field or another layout axis can share this exact
|
||||
// name, and reusing that shared slot would give this row a
|
||||
// column typed 'element'/'layout' that it doesn't declare,
|
||||
// dropping the control right back out (#569 follow-up).
|
||||
var leafId = 'layout-leaf:' + key;
|
||||
if (!seen.has(leafId)) { seen.set(leafId, 'layout-leaf'); }
|
||||
}
|
||||
});
|
||||
var known = COLUMN_ORDER.filter(function (f) { return seen.get(f); });
|
||||
@@ -418,10 +424,12 @@
|
||||
return COLUMN_ORDER.indexOf(f) === -1;
|
||||
}).sort();
|
||||
return known.concat(extra).map(function (f) {
|
||||
var isLeafId = f.indexOf('layout-leaf:') === 0;
|
||||
var fieldKey = isLeafId ? f.slice('layout-leaf:'.length) : f;
|
||||
return {
|
||||
key: f,
|
||||
key: fieldKey,
|
||||
where: seen.get(f),
|
||||
label: own(COLUMN_LABELS, f) || f.replace(/_/g, ' ')
|
||||
label: own(COLUMN_LABELS, fieldKey) || fieldKey.replace(/_/g, ' ')
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user