Description
translate-zone-names.ts maps source page zones to target template sections by array position rather than by name, which can silently place modules in the wrong zones when the source and target templates define their sections in a different order.
Location
src/lib/pushers/page-pusher/translate-zone-names.ts, lines 16–19
Affected Code
for (let i = 0; i < sourceZoneEntries.length && i < sectionNames.length; i++) {
const [sourceZoneName, zoneContent] = sourceZoneEntries[i];
const targetZoneName = sectionNames[i]; // matched purely by position
translatedZones[targetZoneName] = zoneContent;
}
sectionNames is built by sorting contentSectionDefinitions by itemOrder — but Object.entries(sourceZones) returns source zones in whatever order the page object has them, which is not guaranteed to match the target template's section order.
Scenario That Breaks It
- Source template sections:
[Main, Sidebar] (itemOrder 1, 2)
- Target template sections:
[Sidebar, Main] (itemOrder 1, 2)
- Result: all Main modules pushed into Sidebar, and vice versa — silently, with no error
Expected Behaviour
Zones should be matched by name (sourceZoneName === targetZoneName) where a match exists, with positional fallback only when names don't match (i.e. when the template itself has been renamed between instances).
Impact
Content is not corrupted in the mapping files, but modules land in the wrong zones on the pushed page. No error is raised.
Description
translate-zone-names.tsmaps source page zones to target template sections by array position rather than by name, which can silently place modules in the wrong zones when the source and target templates define their sections in a different order.Location
src/lib/pushers/page-pusher/translate-zone-names.ts, lines 16–19Affected Code
sectionNamesis built by sortingcontentSectionDefinitionsbyitemOrder— butObject.entries(sourceZones)returns source zones in whatever order the page object has them, which is not guaranteed to match the target template's section order.Scenario That Breaks It
[Main, Sidebar](itemOrder 1, 2)[Sidebar, Main](itemOrder 1, 2)Expected Behaviour
Zones should be matched by name (
sourceZoneName === targetZoneName) where a match exists, with positional fallback only when names don't match (i.e. when the template itself has been renamed between instances).Impact
Content is not corrupted in the mapping files, but modules land in the wrong zones on the pushed page. No error is raised.